Comment on Can't compile "iwlwifi" module in Linux

cbarrick@lemmy.world ⁨1⁩ ⁨year⁩ ago

Why is it?

The code hitting that error is here:

git.kernel.org/pub/scm/linux/…/subcmd-util.h

It looks fine to me.

What you are seeing is a warning that your compuler may have found a use-after-free bug, but I think this is a false positive. Your build is configured to turn this warning into a hard error.

How to fix it?

I think it will be difficult to know how to fix this without knowing more about your build setup. Are you passing any custom CFLAGS? What compiler and version are you using?

Also, here is someone asking about the same issue (in the same code) on Stack Exchange using GGC 12.1:

unix.stackexchange.com/…/linux-kernel-5-15-54-com…

This was the top result when Googling linux “-Werror=use-after-free”.

I believe you can disable this warning in this file by adding a pragma after the includes (line 8):

#pragma GCC diagnostic ignored "-Wuse-after-free"

See stackoverflow.com/…/selectively-remove-a-warning-…

source
Sort:hotnewtop