linux/tools/testing/selftests/user_events
Ankit Khushwaha 216158f063 selftests/user_events: fix type cast for write_index packed member in perf_test
Accessing 'reg.write_index' directly triggers a -Waddress-of-packed-member
warning due to potential unaligned pointer access:

perf_test.c:239:38: warning: taking address of packed member 'write_index'
of class or structure 'user_reg' may result in an unaligned pointer value
[-Waddress-of-packed-member]
  239 |         ASSERT_NE(-1, write(self->data_fd, &reg.write_index,
      |                                             ^~~~~~~~~~~~~~~

Since write(2) works with any alignment. Casting '&reg.write_index'
explicitly to 'void *' to suppress this warning.

Link: https://lkml.kernel.org/r/20251106095532.15185-1-ankitkhushwaha.linux@gmail.com
Fixes: 42187bdc3c ("selftests/user_events: Add perf self-test for empty arguments events")
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
Cc: Beau Belgrave <beaub@linux.microsoft.com>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: sunliming <sunliming@kylinos.cn>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-15 10:52:02 -08:00
..
.gitignore selftests/user_events: add gitignore file 2023-10-05 14:22:46 -06:00
abi_test.c selftests/user_events: Test multi-format events 2024-03-18 10:13:12 -04:00
config selftests: user_events: create test-specific Kconfig fragments 2023-09-11 17:06:48 -06:00
dyn_test.c selftests/user_events: Fix failures caused by test code 2025-02-24 16:37:17 -07:00
ftrace_test.c selftests/user_events: Add non-spacing separator check 2024-05-13 12:15:46 -04:00
Makefile selftests/user_events: Reenable build 2023-08-16 10:29:57 -06:00
perf_test.c selftests/user_events: fix type cast for write_index packed member in perf_test 2025-11-15 10:52:02 -08:00
settings
user_events_selftests.h selftests/user_events: Fix to unmount tracefs when test created mount 2023-09-18 11:04:52 -06:00