Patch "selftests/bpf: Fix endianness issue in test_sockopt_sk" has been added to the 5.9-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 endianness issue in test_sockopt_sk

to the 5.9-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-endianness-issue-in-test_sockopt_s.patch
and it can be found in the queue-5.9 subdirectory.

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



commit 7e104cede32f594027afc0bc80872c9df4e32af9
Author: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
Date:   Tue Sep 15 13:39:28 2020 +0200

    selftests/bpf: Fix endianness issue in test_sockopt_sk
    
    [ Upstream commit fec47bbc10b243690f5d0ee484a0bbdee273e71b ]
    
    getsetsockopt() calls getsockopt() with optlen == 1, but then checks
    the resulting int. It is ok on little endian, but not on big endian.
    
    Fix by checking char instead.
    
    Fixes: 8a027dc0d8f5 ("selftests/bpf: add sockopt test that exercises sk helpers")
    Signed-off-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Acked-by: Andrii Nakryiko <andriin@xxxxxx>
    Link: https://lore.kernel.org/bpf/20200915113928.3768496-1-iii@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
index 5f54c6aec7f07..b25c9c45c1484 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
@@ -45,9 +45,9 @@ static int getsetsockopt(void)
 		goto err;
 	}
 
-	if (*(int *)big_buf != 0x08) {
+	if (*big_buf != 0x08) {
 		log_err("Unexpected getsockopt(IP_TOS) optval 0x%x != 0x08",
-			*(int *)big_buf);
+			(int)*big_buf);
 		goto err;
 	}
 



[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