Commit 035bfd05 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller
Browse files

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: default avatarJan Engelhardt <jengelh@inai.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3ad434a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)
{
	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)