Patch "selftests/bpf: Fix casting error when cross-compiling test_verifier for 32-bit platforms" has been added to the 6.0-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 casting error when cross-compiling test_verifier for 32-bit platforms

to the 6.0-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-casting-error-when-cross-compiling.patch
and it can be found in the queue-6.0 subdirectory.

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



commit f50b1325911a00d01e5b86bb6cf858074c57b44d
Author: Pu Lehui <pulehui@xxxxxxxxxx>
Date:   Tue Nov 8 20:19:45 2022 +0800

    selftests/bpf: Fix casting error when cross-compiling test_verifier for 32-bit platforms
    
    [ Upstream commit 0811664da064c6d7ca64c02f5579f758a007e52d ]
    
    When cross-compiling test_verifier for 32-bit platforms, the casting error is shown below:
    
    test_verifier.c:1263:27: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
     1263 |  info.xlated_prog_insns = (__u64)*buf;
          |                           ^
    cc1: all warnings being treated as errors
    
    Fix it by adding zero-extension for it.
    
    Fixes: 933ff53191eb ("selftests/bpf: specify expected instructions in test_verifier tests")
    Signed-off-by: Pu Lehui <pulehui@xxxxxxxxxx>
    Acked-by: Yonghong Song <yhs@xxxxxx>
    Link: https://lore.kernel.org/r/20221108121945.4104644-1-pulehui@xxxxxxxxxxxxxxx
    Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index f9d553fbf68a..ce97a9262698 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -1260,7 +1260,7 @@ static int get_xlated_program(int fd_prog, struct bpf_insn **buf, int *cnt)
 
 	bzero(&info, sizeof(info));
 	info.xlated_prog_len = xlated_prog_len;
-	info.xlated_prog_insns = (__u64)*buf;
+	info.xlated_prog_insns = (__u64)(unsigned long)*buf;
 	if (bpf_obj_get_info_by_fd(fd_prog, &info, &info_len)) {
 		perror("second bpf_obj_get_info_by_fd failed");
 		goto out_free_buf;



[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