[bug report] Memoryless nodes: Generic management of nodemasks for various purposes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello mm devs,

The patch 13808910713a: "Memoryless nodes: Generic management of
nodemasks for various purposes" from Oct 16, 2007, leads to the
following Smatch static checker warning:

	./include/linux/nodemask.h:416 node_state()
	warn: passing negative bit value '(-1)-1023' to 'test_bit()'

./include/linux/nodemask.h
    406 /*
    407  * The following particular system nodemasks and operations
    408  * on them manage all possible and online nodes.
    409  */
    410 
    411 extern nodemask_t node_states[NR_NODE_STATES];
    412 
    413 #if MAX_NUMNODES > 1
    414 static inline int node_state(int node, enum node_states state)
    415 {
--> 416         return node_isset(node, node_states[state]);
    417 }

Smatch thinks there are a bunch of callers which seem to pass
NUMA_NO_NODE (-1) as the "node" value.  Passing -1 as a bit number to
test_bit() is a bug.

Looking through the callers it feels like Smatch is probably correct.

drivers/iommu/intel/dmar.c | dmar_parse_one_rhsa |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/acpi/numa/hmat.c | alloc_memory_initiator |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/acpi/numa/hmat.c | hmat_parse_locality |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/acpi/numa/hmat.c | hmat_register_target_initiators |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/base/node.c | node_set_perf_attrs |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/base/node.c | node_add_cache |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/base/node.c | register_memory_node_under_compute_node |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
drivers/base/node.c | register_memory_node_under_compute_node |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64
kernel/sched/fair.c | task_numa_placement |           node_state |        PARAM_VALUE |  0 |            node | (-1)-64

regards,
dan carpenter




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux