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)
commit4829c791b22f98f95339248a428caf08b5f1e3e5
treeccd014d07bde7da164bf24375d263f1952c6eb49
parentfaf65dde844affa9e360ccaa4bd231c2a04b87ea
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