* [jpirko-mlxsw:petrm_resilient 5/5] net/ipv4/nexthop.c:2617:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
@ 2020-11-20 17:57 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-11-20 17:57 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3505 bytes --]
tree: https://github.com/jpirko/linux_mlxsw petrm_resilient
head: eb6c13f4558923f62bfb794b90fdbd041b103c75
commit: eb6c13f4558923f62bfb794b90fdbd041b103c75 [5/5] debugfs for nexthop [xxx]
config: mips-randconfig-r032-20201120 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 3ded927cf80ac519f9f9c4664fef08787f7c537d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/jpirko/linux_mlxsw/commit/eb6c13f4558923f62bfb794b90fdbd041b103c75
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw petrm_resilient
git checkout eb6c13f4558923f62bfb794b90fdbd041b103c75
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/ipv4/nexthop.c:2617:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (pos == size)
^~~~~~~~~~~
net/ipv4/nexthop.c:2650:9: note: uninitialized use occurs here
return err ?: size;
^~~
net/ipv4/nexthop.c:2617:2: note: remove the 'if' if its condition is always false
if (pos == size)
^~~~~~~~~~~~~~~~
net/ipv4/nexthop.c:2613:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
1 warning generated.
vim +2617 net/ipv4/nexthop.c
2600
2601 static ssize_t nexthop_dfs_bucket_activity_write(struct file *file,
2602 const char __user *user_buf,
2603 size_t size, loff_t *ppos)
2604 {
2605 const char *tok_bucketid;
2606 const char *tok_nhid;
2607 struct nexthop *nh;
2608 loff_t pos = *ppos;
2609 char buf[128];
2610 u16 bucketid; // xxx or u32 if we choose so
2611 char *ptr;
2612 u32 nhid;
2613 int err;
2614
2615 if (pos < 0)
2616 return -EINVAL;
> 2617 if (pos == size)
2618 goto skip;
2619 if (pos)
2620 return -EINVAL;
2621 if (size > sizeof(buf))
2622 return -ENOMEM;
2623 if (copy_from_user(buf, user_buf, size))
2624 return -EFAULT;
2625
2626 buf[sizeof(buf) - 1] = '\0';
2627 ptr = buf;
2628 tok_nhid = strsep(&ptr, " \t");
2629 tok_bucketid = strsep(&ptr, " \t");
2630
2631 if (!tok_nhid || !tok_bucketid || ptr)
2632 return -EINVAL;
2633
2634 err = kstrtou32(tok_nhid, 0, &nhid);
2635 if (err)
2636 return err;
2637
2638 err = kstrtou16(tok_bucketid, 0, &bucketid);
2639 if (err)
2640 return err;
2641
2642 rcu_read_lock();
2643 nh = nexthop_find_by_id(&init_net, nhid);
2644 if (!nh || !nexthop_select_path(nh, bucketid))
2645 err = -ENOENT;
2646 rcu_read_unlock();
2647
2648 skip:
2649 *ppos = size;
2650 return err ?: size;
2651 }
2652
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 26893 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-20 17:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 17:57 [jpirko-mlxsw:petrm_resilient 5/5] net/ipv4/nexthop.c:2617:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.