#include #include #include static const char example[][32] = { "abcd", "xyzt", "1234", "5678" }; static int __init test_init(void) { char data0[128], data1[128]; /* No warnings with both gcc 13.1.1 and clang 16.0.5 */ memcpy(data0, example, sizeof(example)); /* No warning with gcc 13.1.1 but warning with clang 16.0.5: ./include/linux/fortify-string.h:529:4: warning: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning] __read_overflow2_field(q_size_field, size); */ memcpy(data1, *example, sizeof(example)); return 0; } static void __exit test_exit(void) { } module_init(test_init); module_exit(test_exit); MODULE_LICENSE("GPL");