Project

General

Profile

Actions

Bug #7922

open

Problem with kernel config in linux:bitops (old 129_1a) rule

Added by Vitaly Mordan over 7 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Requirement specifications
Target version:
-
Start date:
01/27/2017
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:

Description

This rule depends on kernel parameter CONFIG_NR_CPUS, which is used for global constant

extern int nr_cpu_ids;

In allmodconfig this constant is quite big (8192), but if we reduce it (for example, up to 10), nr_cpu_ids can be taken greater, which leads to false positives for this rule.
Therefore current expression

ldv_assume(nr_cpu_ids > 0);

does not work, since we need to add upper bound as well.
The question is which value will be safe there for any config, which will not lead to missed bugs in general case.

Actions #1

Updated by Vitaly Mordan over 7 years ago

The correct bound is

nr_cpu_ids > 0 && nr_cpu_ids <= NR_CPUS

(see kernel documentation)

Actions #2

Updated by Vitaly Mordan over 7 years ago

This will resolve a lot of false positives on all linux kernel modules.

Actions #3

Updated by Vitaly Mordan over 7 years ago

Fixed in branch fix_129_config.

Actions

Also available in: Atom PDF