From: kbuild test robot <l...@intel.com>
Date: Sun, 18 Nov 2018 07:13:44 +0800

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
> master
> head:   f9e06c45cb28beb30a6a474952ead7da2b8940f3
> commit: f9e06c45cb28beb30a6a474952ead7da2b8940f3 [114/114] tuntap: free XDP 
> dropped packets in a batch
> config: x86_64-allmodconfig (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
>         git checkout f9e06c45cb28beb30a6a474952ead7da2b8940f3
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All warnings (new ones prefixed by >>):
> 
>    include/linux/slab.h:332:43: warning: dubious: x & !y
>    include/linux/slab.h:332:43: warning: dubious: x & !y
>>> drivers/net/tun.c:2503:42: warning: Using plain integer as NULL pointer

Fixed as follows:

====================
>From 6f0271d92963bc8588ad7058622ec7b1e94852de Mon Sep 17 00:00:00 2001
From: "David S. Miller" <da...@davemloft.net>
Date: Sat, 17 Nov 2018 16:53:46 -0800
Subject: [PATCH] tun: Adjust on-stack tun_page initialization.

Instead of constantly playing with the struct initializer
syntax trying to make gcc and CLang both happy, just clear
it out using memset().

>> drivers/net/tun.c:2503:42: warning: Using plain integer as NULL pointer

Reported-by: kbuild test robot <l...@intel.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
---
 drivers/net/tun.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index e90a7923a5f6..36163a147d39 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2500,10 +2500,12 @@ static int tun_sendmsg(struct socket *sock, struct 
msghdr *m, size_t total_len)
                return -EBADFD;
 
        if (ctl && (ctl->type == TUN_MSG_PTR)) {
-               struct tun_page tpage = {0};
+               struct tun_page tpage;
                int n = ctl->num;
                int flush = 0;
 
+               memset(&tpage, 0, sizeof(tpage));
+
                local_bh_disable();
                rcu_read_lock();
 
-- 
2.19.1

Reply via email to