public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yue Haibing <yuehaibing@huawei.com>,
	davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] ipv6: sit: remove redundant ret = 0 assignment
Date: Thu, 30 Apr 2026 08:49:23 +0800	[thread overview]
Message-ID: <202604300826.7OKegoUR-lkp@intel.com> (raw)
In-Reply-To: <20260403084402.4105936-1-yuehaibing@huawei.com>

Hi Yue,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Yue-Haibing/ipv6-sit-remove-redundant-ret-0-assignment/20260425-024700
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260403084402.4105936-1-yuehaibing%40huawei.com
patch subject: [PATCH net-next] ipv6: sit: remove redundant ret = 0 assignment
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20260430/202604300826.7OKegoUR-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260430/202604300826.7OKegoUR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604300826.7OKegoUR-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> net/ipv6/sit.c:362:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     362 |         if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/ipv6/sit.c:367:9: note: uninitialized use occurs here
     367 |         return ret;
         |                ^~~
   net/ipv6/sit.c:362:2: note: remove the 'if' if its condition is always true
     362 |         if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     363 |                 ret = -EFAULT;
   net/ipv6/sit.c:312:9: note: initialize the variable 'ret' to silence this warning
     312 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +362 net/ipv6/sit.c

fadf6bf0606913 Templin, Fred L   2008-03-11  305  
3e7a1c7c561ed8 Arnd Bergmann     2021-07-27  306  static int ipip6_tunnel_get_prl(struct net_device *dev, struct ip_tunnel_prl __user *a)
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  307  {
fd5d687b76b325 Christoph Hellwig 2020-05-19  308  	struct ip_tunnel *t = netdev_priv(dev);
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  309  	struct ip_tunnel_prl kprl, *kp;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  310  	struct ip_tunnel_prl_entry *prl;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  311  	unsigned int cmax, c = 0, ca, len;
3c6132ccc58e8a Yue Haibing       2026-04-08  312  	int ret;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  313  
fd5d687b76b325 Christoph Hellwig 2020-05-19  314  	if (dev == dev_to_sit_net(dev)->fb_tunnel_dev)
fd5d687b76b325 Christoph Hellwig 2020-05-19  315  		return -EINVAL;
fd5d687b76b325 Christoph Hellwig 2020-05-19  316  
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  317  	if (copy_from_user(&kprl, a, sizeof(kprl)))
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  318  		return -EFAULT;
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  319  	cmax = kprl.datalen / sizeof(kprl);
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  320  	if (cmax > 1 && kprl.addr != htonl(INADDR_ANY))
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  321  		cmax = 1;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  322  
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  323  	/* For simple GET or for root users,
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  324  	 * we try harder to allocate.
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  325  	 */
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  326  	kp = (cmax <= 1 || capable(CAP_NET_ADMIN)) ?
69050f8d6d075d Kees Cook         2026-02-20  327  		kzalloc_objs(*kp, cmax, GFP_KERNEL_ACCOUNT | __GFP_NOWARN) :
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  328  		NULL;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  329  
284fda1eff8a8b kernel test robot 2021-03-27  330  	ca = min(t->prl_count, cmax);
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  331  
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  332  	if (!kp) {
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  333  		/* We don't try hard to allocate much memory for
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  334  		 * non-root users.
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  335  		 * For root users, retry allocating enough memory for
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  336  		 * the answer.
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  337  		 */
69050f8d6d075d Kees Cook         2026-02-20  338  		kp = kzalloc_objs(*kp, ca,
69050f8d6d075d Kees Cook         2026-02-20  339  				  GFP_ATOMIC | __GFP_ACCOUNT | __GFP_NOWARN);
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  340  		if (!kp) {
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  341  			ret = -ENOMEM;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  342  			goto out;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  343  		}
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  344  	}
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  345  
adabdd8f6acabc katrinzhou        2022-06-28  346  	rcu_read_lock();
ef9a9d1183b36f Eric Dumazet      2009-10-23  347  	for_each_prl_rcu(t->prl) {
298bf12ddb2584 Sascha Hlusiak    2009-09-29  348  		if (c >= cmax)
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  349  			break;
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  350  		if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr)
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  351  			continue;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  352  		kp[c].addr = prl->addr;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  353  		kp[c].flags = prl->flags;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  354  		c++;
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  355  		if (kprl.addr != htonl(INADDR_ANY))
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  356  			break;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  357  	}
adabdd8f6acabc katrinzhou        2022-06-28  358  
ef9a9d1183b36f Eric Dumazet      2009-10-23  359  	rcu_read_unlock();
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  360  
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  361  	len = sizeof(*kp) * c;
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16 @362  	if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen))
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  363  		ret = -EFAULT;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  364  
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  365  	kfree(kp);
adabdd8f6acabc katrinzhou        2022-06-28  366  out:
2b4743bd6be9fe YOSHIFUJI Hideaki 2008-06-16  367  	return ret;
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  368  }
300aaeeaab5f44 YOSHIFUJI Hideaki 2008-03-24  369  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

      parent reply	other threads:[~2026-04-30  0:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03  8:44 [PATCH net-next] ipv6: sit: remove redundant ret = 0 assignment Yue Haibing
2026-04-06 14:35 ` Simon Horman
2026-04-07  1:43 ` Jakub Kicinski
2026-04-08  1:26   ` Yue Haibing
2026-04-30  0:49 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202604300826.7OKegoUR-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox