ok: unsafe memcmp() usage correctly detected with '__read_overflow' in lib/test_fortify/read_overflow-memcmp.c
lib/test_fortify/test_fortify.h: In function ‘do_fortify_tests’:
lib/test_fortify/read_overflow-memcmp.c:3:9: error: statement with no effect [-Werror=unused-value]
3 | memcmp(small, large, sizeof(small) + 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/test_fortify/test_fortify.h:34:9: note: in expansion of macro ‘TEST’
34 | TEST;
| ^~~~
In file included from ./include/linux/string.h:396,
from ./include/linux/bitmap.h:13,
from ./include/linux/cpumask.h:11,
from ./arch/x86/include/asm/paravirt.h:19,
from ./arch/x86/include/asm/irqflags.h:100,
from ./include/linux/irqflags.h:18,
from ./include/linux/spinlock.h:59,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/slab.h:17,
from lib/test_fortify/test_fortify.h:4,
from lib/test_fortify/read_overflow-memcmp.c:5:
In function ‘memcmp’,
inlined from ‘do_fortify_tests’ at lib/test_fortify/test_fortify.h:34:2:
./include/linux/fortify-string.h:667:25: error: call to ‘__read_overflow’ declared with attribute error: detected read beyond size of object (1st parameter)
667 | __read_overflow();
| ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors