Daniel Axtens <dja(a)axtens.net> writes:
>> include/linux/string.h:297:30: warning: '__builtin_strncpy' specified
bound 8 equals destination size [-Wstringop-truncation]
>> 297 | #define __underlying_strncpy __builtin_strncpy
>> | ^
>> >> include/linux/string.h:307:9: note: in expansion of macro
>> 307 | return __underlying_strncpy(p, q, size);
>> | ^~~~~~~~~~~~~~~~~~~~
> Looks like another false positive.
> Daniel, is there a practical way of suppressing these?
I think we probably want '-Wno-stringop-truncation'. That will stop
warnings where the bound equals the destination size (so there won't be
any null-truncation). But it won't stop the overflow warnings about
full-on overflows (-Wstringop-overflow).
Ah, so both stringop-truncate and stringop-overflow are disabled in
- commit 5a76021c2eff ("gcc-10: disable 'stringop-overflow' warning for
- commit 217c3e019675 ("disable stringop truncation warnings for now")
However, at W=1, stringop-truncate is re-enabled - last touched commit
64a91907c896 ("kbuild: refactor scripts/Makefile.extrawarn"). That would
explain why we see this on test builds with W=1 only.
I'll bump it to W=2.
> I'll send a patch.