Patch "selftests/bpf: Fix incorrect parameters in NULL pointer checking" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests/bpf: Fix incorrect parameters in NULL pointer checking

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-bpf-fix-incorrect-parameters-in-null-point.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0da748aff43be4e6e24faf47000fa60be7cfdc32
Author: Hao Ge <gehao@xxxxxxxxxx>
Date:   Tue Aug 20 10:36:22 2024 +0800

    selftests/bpf: Fix incorrect parameters in NULL pointer checking
    
    [ Upstream commit c264487e5410e5a72db8a414566ab7d144223e6c ]
    
    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@xxxxxxxxxx>
    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@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240820023622.29190-1-hao.ge@xxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/testing_helpers.c b/tools/testing/selftests/bpf/testing_helpers.c
index 4230420ef2940..680e452583a78 100644
--- a/tools/testing/selftests/bpf/testing_helpers.c
+++ b/tools/testing/selftests/bpf/testing_helpers.c
@@ -451,7 +451,7 @@ int get_xlated_program(int fd_prog, struct bpf_insn **buf, __u32 *cnt)
 
 	*cnt = xlated_prog_len / buf_element_size;
 	*buf = calloc(*cnt, buf_element_size);
-	if (!buf) {
+	if (!*buf) {
 		perror("can't allocate xlated program buffer");
 		return -ENOMEM;
 	}




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux