diff options
| author | Jose A. Perez de Azpillaga <azpijr@gmail.com> | 2026-09-23 23:27:25 +0200 |
|---|---|---|
| committer | Dave Hansen <dave.hansen@linux.intel.com> | 2026-09-24 12:19:01 -0700 |
| commit | 4f8c177caac8ecdedeb95caa673214fc3f6a75cb (patch) | |
| tree | fb0dae83ea8b3b3b34a7b27ef4f40928aa365c50 /include/uapi/linux | |
| parent | ea6fd393cb9e6811a748c7551de0dd3090f9dcde (diff) | |
| download | linux-next-4f8c177caac8ecdedeb95caa673214fc3f6a75cb.tar.gz linux-next-4f8c177caac8ecdedeb95caa673214fc3f6a75cb.zip | |
x86/mm: Fix void/int conditional in pgd_clear()
sparse building mm/ reports an error for every pgd_clear() caller:
mm/pgtable-generic.c:30:9: error: incompatible types in conditional expression (different base types):
mm/pgtable-generic.c:30:9: void
mm/pgtable-generic.c:30:9: int
pgtable_l5_enabled() ? native_pgd_clear(pgd) : 0 mixes a void function
call with an int constant. C11 6.5.15 requires the second and third
operands of a conditional expression to both have arithmetic type, both
have the same structure or union type, both have void type, or to be
compatible pointer types. void and int are none of those, so this is a
type error, not just a style issue. GCC accepts it as an extension, and
the result type is void, so there is no runtime effect today.
The macro only exists when the p4d level is not folded, that is, when
CONFIG_PGTABLE_LEVELS > 4; with a folded p4d, asm-generic/pgtable-nop4d.h
defines pgd_clear() as a no-op.
All callers use pgd_clear() as a statement (mm/memory.c and friends), so
use the do { } while (0) form, matching the paravirt definition in
asm/paravirt.h.
Found by running sparse 0.6.5-rc1 over mm/. No functional change.
Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://patch.msgid.link/20260923212731.19599-1-azpijr@gmail.com
Diffstat (limited to 'include/uapi/linux')
0 files changed, 0 insertions, 0 deletions
