Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/percpu_counter: add missing __percpu qualifier to a cast

Add missing __percpu qualifier to a (void *) cast to fix

percpu_counter.c:212:36: warning: cast removes address space '__percpu' of expression
percpu_counter.c:212:33: warning: incorrect type in assignment (different address spaces)
percpu_counter.c:212:33: expected signed int [noderef] [usertype] __percpu *counters
percpu_counter.c:212:33: got void *

sparse warnings.

Found by GCC's named address space checks.

There were no changes in the resulting object file.

Link: https://lkml.kernel.org/r/20240814064437.940162-1-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Uros Bizjak and committed by
Andrew Morton
16d9691a cbf164cd

+1 -1
+1 -1
lib/percpu_counter.c
··· 209 209 INIT_LIST_HEAD(&fbc[i].list); 210 210 #endif 211 211 fbc[i].count = amount; 212 - fbc[i].counters = (void *)counters + (i * counter_size); 212 + fbc[i].counters = (void __percpu *)counters + i * counter_size; 213 213 214 214 debug_percpu_counter_activate(&fbc[i]); 215 215 }