From: Lu Wei luwei32@huawei.com
hulk inclusion category: bugfix bugzilla: 187830, https://gitee.com/openeuler/kernel/issues/I9K8D1
--------------------------------
32 is a magic number, use "BITS_PER_BYTE * sizeof(u32)" to replace it.
Fixes: 0a0306da1658 ("bpf: Add bpf_get_sockops_uid_gid helper function") Signed-off-by: Lu Wei luwei32@huawei.com Signed-off-by: Dong Chenchen dongchenchen2@huawei.com --- net/core/filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c index 4f4e832f3e9f..96a3e7f5c9e3 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -5107,7 +5107,8 @@ BPF_CALL_1(bpf_get_sockops_uid_gid, struct bpf_sock_ops_kern *, bpf_sock) uid = sock_net_uid(sock_net(sk), sk); gid = sock_net_gid(sock_net(sk), sk);
- return ((u64)from_kgid_munged(sock_net(sk)->user_ns, gid)) << 32 | + return ((u64)from_kgid_munged(sock_net(sk)->user_ns, gid)) << + (BITS_PER_BYTE * sizeof(u32)) | from_kuid_munged(sock_net(sk)->user_ns, uid); }