]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: Fix error compiling test_lru_map.c
authorTony Ambardar <tony.ambardar@gmail.com>
Mon, 29 Jul 2024 09:24:19 +0000 (02:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:18 +0000 (16:29 +0200)
commit99c03869599cf474922fe3343977d2f686f59543
tree3c26707794176681a3d506d296d2ab44c5505439
parent564d1abf506b180e5682afcb89dfa8e0a4a995e7
selftests/bpf: Fix error compiling test_lru_map.c

[ Upstream commit cacf2a5a78cd1f5f616eae043ebc6f024104b721 ]

Although the post-increment in macro 'CPU_SET(next++, &cpuset)' seems safe,
the sequencing can raise compile errors, so move the increment outside the
macro. This avoids an error seen using gcc 12.3.0 for mips64el/musl-libc:

  In file included from test_lru_map.c:11:
  test_lru_map.c: In function 'sched_next_online':
  test_lru_map.c:129:29: error: operation on 'next' may be undefined [-Werror=sequence-point]
    129 |                 CPU_SET(next++, &cpuset);
        |                             ^
  cc1: all warnings being treated as errors

Fixes: 3fbfadce6012 ("bpf: Fix test_lru_sanity5() in test_lru_map.c")
Signed-off-by: Tony Ambardar <tony.ambardar@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/22993dfb11ccf27925a626b32672fd3324cb76c4.1722244708.git.tony.ambardar@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_lru_map.c