提交 035bfd05 编写于 作者: C Christoph Hellwig 提交者: David S. Miller

net: make sockptr_is_null strict aliasing safe

While the kernel in general is not strict aliasing safe we can trivially
do that in sockptr_is_null without affecting code generation, so always
check the actually assigned union member.
Reported-by: NJan Engelhardt <jengelh@inai.de>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a3ad434a
...@@ -64,7 +64,9 @@ static inline int __must_check init_user_sockptr(sockptr_t *sp, void __user *p) ...@@ -64,7 +64,9 @@ static inline int __must_check init_user_sockptr(sockptr_t *sp, void __user *p)
static inline bool sockptr_is_null(sockptr_t sockptr) static inline bool sockptr_is_null(sockptr_t sockptr)
{ {
return !sockptr.user && !sockptr.kernel; if (sockptr_is_kernel(sockptr))
return !sockptr.kernel;
return !sockptr.user;
} }
static inline int copy_from_sockptr(void *dst, sockptr_t src, size_t size) static inline int copy_from_sockptr(void *dst, sockptr_t src, size_t size)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册