]> git.baikalelectronics.ru Git - kernel.git/commit
percpu: initialize best_upa variable
authorDennis Zhou <dennis@kernel.org>
Mon, 14 Jun 2021 14:42:05 +0000 (14:42 +0000)
committerDennis Zhou <dennis@kernel.org>
Mon, 14 Jun 2021 14:42:05 +0000 (14:42 +0000)
commit16626cd41320e2f6351e68496fd52d1a6fc0b7b7
treeccd014d07bde7da164bf24375d263f1952c6eb49
parentf57296cba693a6e7b020163457b666f3ba54a102
percpu: initialize best_upa variable

Tom reported this finding from clang 10's static analysis [1].

Due to the way the code is written, it will always see a successful loop
iteration. Instead of setting an initial value, check that it was set
instead with BUG_ON() because 0 units per allocation is bogus.

[1] https://lore.kernel.org/lkml/20210515180817.1751084-1-trix@redhat.com/

Reported-by: Tom Rix <trix@redhat.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
mm/percpu.c