From: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mm@kvack.org
Subject: [bug report] Memoryless nodes: Generic management of nodemasks for various purposes
Date: Tue, 15 Mar 2022 17:27:46 +0300 [thread overview]
Message-ID: <20220315142746.GA19924@kili> (raw)
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
reply other threads:[~2022-03-15 14:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220315142746.GA19924@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox