* [bug report] Memoryless nodes: Generic management of nodemasks for various purposes
@ 2022-03-15 14:27 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-03-15 14:27 UTC (permalink / raw)
Cc: linux-mm
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-15 14:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-15 14:27 [bug report] Memoryless nodes: Generic management of nodemasks for various purposes Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.