linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* clang-22 -Walloc-size in mm/kfence/kfence_test.c in 6.6 and 6.1
@ 2025-09-03  0:07 Nathan Chancellor
  2025-09-03  3:40 ` Matthew Wilcox
  2025-09-03  6:00 ` Marco Elver
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2025-09-03  0:07 UTC (permalink / raw)
  To: Alexander Potapenko, Marco Elver; +Cc: Dmitry Vyukov, kasan-dev, linux-mm, llvm

Hi kfence folks,

After [1] in clang, I am seeing an instance of this pop up in
mm/kfence/kfence_test.c on linux-6.6.y and linux-6.1.y:

  mm/kfence/kfence_test.c:723:8: error: allocation of insufficient size '0' for type 'char' with size '1' [-Werror,-Walloc-size]
    723 |         buf = krealloc(buf, 0, GFP_KERNEL); /* Free. */
        |               ^

I do not see this in linux-6.12.y or newer but I wonder if that is just
because the memory allocation profiling adds some indirection that makes
it harder for clang to perform this analysis?

Should this warning just be silenced for this translation unit or is
there some other fix that could be done here?

[1]: https://github.com/llvm/llvm-project/commit/6dc188d4eb15cbe9bdece3d940f03d93b926328c

Cheers,
Nathan


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-03 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-03  0:07 clang-22 -Walloc-size in mm/kfence/kfence_test.c in 6.6 and 6.1 Nathan Chancellor
2025-09-03  3:40 ` Matthew Wilcox
2025-09-03  6:00 ` Marco Elver
2025-09-03 18:48   ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox