[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202203012347.yd56xhtd-lkp@intel.com>
Date: Wed, 2 Mar 2022 00:06:07 +0800
From: kernel test robot <lkp@...el.com>
To: Meng Tang <tangmeng@...ontech.com>, mcgrof@...nel.org,
keescook@...omium.org, yzaikin@...gle.com, ebiederm@...ssion.com,
willy@...radead.org
Cc: kbuild-all@...ts.01.org, nixiaoming@...wei.com,
nizhen@...ontech.com, zhanglianjie@...ontech.com,
sujiaxun@...ontech.com, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Meng Tang <tangmeng@...ontech.com>
Subject: Re: [PATCH v2 1/2] fs/proc: optimize exactly register one ctl_table
Hi Meng,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mcgrof/sysctl-next]
[also build test WARNING on jack-fs/fsnotify rostedt-trace/for-next linus/master v5.17-rc6 next-20220301]
[cannot apply to kees/for-next/pstore]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Meng-Tang/fs-proc-optimize-exactly-register-one-ctl_table/20220301-195515
base: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git sysctl-next
config: nds32-allnoconfig (https://download.01.org/0day-ci/archive/20220301/202203012347.yd56xhtd-lkp@intel.com/config)
compiler: nds32le-linux-gcc (GCC) 11.2.0
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
# https://github.com/0day-ci/linux/commit/d9e9a410cf46b383390d668770fff70540e27528
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Meng-Tang/fs-proc-optimize-exactly-register-one-ctl_table/20220301-195515
git checkout d9e9a410cf46b383390d668770fff70540e27528
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash fs/proc/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
fs/proc/proc_sysctl.c: In function 'new_links_single':
>> fs/proc/proc_sysctl.c:1281:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
1281 | int len = strlen(table->procname) + 1;
| ^~~
fs/proc/proc_sysctl.c: At top level:
>> fs/proc/proc_sysctl.c:1638:26: warning: no previous prototype for '__register_sysctl_table_single' [-Wmissing-prototypes]
1638 | struct ctl_table_header *__register_sysctl_table_single(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/proc/proc_sysctl.c: In function 'put_links_single':
fs/proc/proc_sysctl.c:1988:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
1988 | struct ctl_table_header *link_head;
| ^~~~~~
vim +1281 fs/proc/proc_sysctl.c
1256
1257 static struct ctl_table_header *new_links_single(struct ctl_dir *dir, struct ctl_table *table,
1258 struct ctl_table_root *link_root)
1259 {
1260 struct ctl_table *link_table;
1261 struct ctl_table_header *links;
1262 struct ctl_node *node;
1263 char *link_name;
1264 int name_bytes = 0;
1265
1266 name_bytes += strlen(table->procname) + 1;
1267
1268 links = kzalloc(sizeof(struct ctl_table_header) +
1269 sizeof(struct ctl_node) +
1270 sizeof(struct ctl_table)*2 +
1271 name_bytes,
1272 GFP_KERNEL);
1273
1274 if (!links)
1275 return NULL;
1276
1277 node = (struct ctl_node *)(links + 1);
1278 link_table = (struct ctl_table *)(node + 1);
1279 link_name = (char *)&link_table[2];
1280
> 1281 int len = strlen(table->procname) + 1;
1282
1283 memcpy(link_name, table->procname, len);
1284 link_table->procname = link_name;
1285 link_table->mode = S_IFLNK|S_IRWXUGO;
1286 link_table->data = link_root;
1287 link_name += len;
1288
1289 init_header_single(links, dir->header.root, dir->header.set, node, link_table);
1290 links->nreg = 1;
1291
1292 return links;
1293 }
1294 static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table *table,
1295 struct ctl_table_root *link_root)
1296 {
1297 struct ctl_table *link_table, *entry, *link;
1298 struct ctl_table_header *links;
1299 struct ctl_node *node;
1300 char *link_name;
1301 int nr_entries, name_bytes;
1302
1303 name_bytes = 0;
1304 nr_entries = 0;
1305 for (entry = table; entry->procname; entry++) {
1306 nr_entries++;
1307 name_bytes += strlen(entry->procname) + 1;
1308 }
1309
1310 links = kzalloc(sizeof(struct ctl_table_header) +
1311 sizeof(struct ctl_node)*nr_entries +
1312 sizeof(struct ctl_table)*(nr_entries + 1) +
1313 name_bytes,
1314 GFP_KERNEL);
1315
1316 if (!links)
1317 return NULL;
1318
1319 node = (struct ctl_node *)(links + 1);
1320 link_table = (struct ctl_table *)(node + nr_entries);
1321 link_name = (char *)&link_table[nr_entries + 1];
1322
1323 for (link = link_table, entry = table; entry->procname; link++, entry++) {
1324 int len = strlen(entry->procname) + 1;
1325 memcpy(link_name, entry->procname, len);
1326 link->procname = link_name;
1327 link->mode = S_IFLNK|S_IRWXUGO;
1328 link->data = link_root;
1329 link_name += len;
1330 }
1331 init_header(links, dir->header.root, dir->header.set, node, link_table);
1332 links->nreg = nr_entries;
1333
1334 return links;
1335 }
1336
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists