Re: [PATCH v4] proc/sysctl: add shared variables for range check

From: kbuild test robot
Date: Mon Apr 29 2019 - 19:59:34 EST


Hi Matteo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on v5.1-rc7]
[cannot apply to next-20190429]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Matteo-Croce/proc-sysctl-add-shared-variables-for-range-check/20190430-065026
config: i386-randconfig-x015-201917 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

net/mpls/af_mpls.c: In function 'mpls_conf_proc':
>> net/mpls/af_mpls.c:1370:27: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
struct mpls_dev *mdev = ctl->extra1;
^~~
net/mpls/af_mpls.c:1372:21: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
struct net *net = ctl->extra2;
^~~

vim +/const +1370 net/mpls/af_mpls.c

24045a03 David Ahern 2017-02-20 1358
37bde799 Robert Shearman 2015-04-22 1359 #define MPLS_PERDEV_SYSCTL_OFFSET(field) \
37bde799 Robert Shearman 2015-04-22 1360 (&((struct mpls_dev *)0)->field)
37bde799 Robert Shearman 2015-04-22 1361
24045a03 David Ahern 2017-02-20 1362 static int mpls_conf_proc(struct ctl_table *ctl, int write,
24045a03 David Ahern 2017-02-20 1363 void __user *buffer,
24045a03 David Ahern 2017-02-20 1364 size_t *lenp, loff_t *ppos)
24045a03 David Ahern 2017-02-20 1365 {
24045a03 David Ahern 2017-02-20 1366 int oval = *(int *)ctl->data;
24045a03 David Ahern 2017-02-20 1367 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
24045a03 David Ahern 2017-02-20 1368
24045a03 David Ahern 2017-02-20 1369 if (write) {
24045a03 David Ahern 2017-02-20 @1370 struct mpls_dev *mdev = ctl->extra1;
24045a03 David Ahern 2017-02-20 1371 int i = (int *)ctl->data - (int *)mdev;
24045a03 David Ahern 2017-02-20 1372 struct net *net = ctl->extra2;
24045a03 David Ahern 2017-02-20 1373 int val = *(int *)ctl->data;
24045a03 David Ahern 2017-02-20 1374
24045a03 David Ahern 2017-02-20 1375 if (i == offsetof(struct mpls_dev, input_enabled) &&
24045a03 David Ahern 2017-02-20 1376 val != oval) {
823566ae David Ahern 2017-03-28 1377 mpls_netconf_notify_devconf(net, RTM_NEWNETCONF,
823566ae David Ahern 2017-03-28 1378 NETCONFA_INPUT, mdev);
24045a03 David Ahern 2017-02-20 1379 }
24045a03 David Ahern 2017-02-20 1380 }
24045a03 David Ahern 2017-02-20 1381
24045a03 David Ahern 2017-02-20 1382 return ret;
24045a03 David Ahern 2017-02-20 1383 }
24045a03 David Ahern 2017-02-20 1384

:::::: The code at line 1370 was first introduced by commit
:::::: 24045a03b8796e3e1ddb370dfe4bc592a9f5f301 net: mpls: Add support for netconf

:::::: TO: David Ahern <dsa@xxxxxxxxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip