]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: Fix incorrect parameters in NULL pointer checking
authorHao Ge <gehao@kylinos.cn>
Tue, 20 Aug 2024 02:36:22 +0000 (10:36 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 28 Aug 2024 15:44:29 +0000 (08:44 -0700)
commitc264487e5410e5a72db8a414566ab7d144223e6c
tree4dcf63420a3daf22032555515621ec30a287a258
parent4961d8f47b140a9b48c63de091f99dbf7b32a23b
selftests/bpf: Fix incorrect parameters in NULL pointer checking

Smatch reported the following warning:
    ./tools/testing/selftests/bpf/testing_helpers.c:455 get_xlated_program()
    warn: variable dereferenced before check 'buf' (see line 454)

It seems correct,so let's modify it based on it's suggestion.

Actually,commit b23ed4d74c4d ("selftests/bpf: Fix invalid pointer
check in get_xlated_program()") fixed an issue in the test_verifier.c
once,but it was reverted this time.

Let's solve this issue with the minimal changes possible.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/1eb3732f-605a-479d-ba64-cd14250cbf91@stanley.mountain/
Fixes: b4b7a4099b8c ("selftests/bpf: Factor out get_xlated_program() helper")
Signed-off-by: Hao Ge <gehao@kylinos.cn>
Link: https://lore.kernel.org/r/20240820023622.29190-1-hao.ge@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/testing_helpers.c