Re: [PATCH 1/2] rbtree: Expose a test tree to userspace

From: kernel test robot
Date: Fri Oct 22 2021 - 01:56:49 EST


Hi Mete,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.15-rc6 next-20211021]
[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/Mete-Polat/rbtree-Test-against-a-verified-oracle/20211019-171711
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 519d81956ee277b4419c723adfb154603c2565ba
config: nds32-randconfig-r032-20211019 (attached as .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/d73723d42ad47ca335de00e899a9e94b03d8b57d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Mete-Polat/rbtree-Test-against-a-verified-oracle/20211019-171711
git checkout d73723d42ad47ca335de00e899a9e94b03d8b57d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nds32

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

All warnings (new ones prefixed by >>):

>> lib/test_rbtree_interface.c:91:9: warning: no previous prototype for 'cmd_exec' [-Wmissing-prototypes]
91 | ssize_t cmd_exec(struct file *file, const char __user *ubuf, size_t len, loff_t *offp)
| ^~~~~~~~
>> lib/test_rbtree_interface.c:138:12: warning: no previous prototype for 'rbt_if_init' [-Wmissing-prototypes]
138 | int __init rbt_if_init(void)
| ^~~~~~~~~~~
>> lib/test_rbtree_interface.c:149:13: warning: no previous prototype for 'rbt_if_exit' [-Wmissing-prototypes]
149 | void __exit rbt_if_exit(void)
| ^~~~~~~~~~~


vim +/cmd_exec +91 lib/test_rbtree_interface.c

90
> 91 ssize_t cmd_exec(struct file *file, const char __user *ubuf, size_t len, loff_t *offp)
92 {
93 int cmd;
94 struct data *data, *_n;
95 struct rb_node *node;
96 int ret = kstrtoint_from_user(ubuf, len, 10, &cmd);
97 if (ret)
98 return ret;
99
100 switch (cmd) {
101 case RESET:
102 rbtree_postorder_for_each_entry_safe(data, _n, &rbt, node)
103 kfree(data);
104 rbt = RB_ROOT;
105 break;
106 case INSERT:
107 data = kzalloc(sizeof(*data), GFP_KERNEL);
108 data->key = input_key;
109 rb_find_add(&data->node, &rbt, node_cmp);
110 break;
111 case DELETE:
112 node = rb_find(&input_key, &rbt, key_cmp);
113 if (!node)
114 break;
115 rb_erase(node, &rbt);
116 kfree(data_from_node(node));
117 break;
118 default:
119 return -EINVAL;
120 }
121 return len;
122 }
123
124 static int cmd_open(struct inode *inode, struct file *file)
125 {
126 return single_open(file, cmd_show, inode->i_private);
127 }
128
129 static const struct file_operations cmd_fops = {
130 .owner = THIS_MODULE,
131 .open = cmd_open,
132 .read = seq_read,
133 .write = cmd_exec,
134 .llseek = seq_lseek,
135 .release = single_release,
136 };
137
> 138 int __init rbt_if_init(void)
139 {
140 rbt_if_root = debugfs_create_dir("rbt_if", NULL);
141 if (IS_ERR(rbt_if_root))
142 return PTR_ERR(rbt_if_root);
143
144 debugfs_create_file("cmd", 0644, rbt_if_root, NULL, &cmd_fops);
145 debugfs_create_u64("key", 0644, rbt_if_root, &input_key);
146 return 0;
147 }
148
> 149 void __exit rbt_if_exit(void)
150 {
151 struct data *_n, *pos;
152 debugfs_remove_recursive(rbt_if_root);
153 rbtree_postorder_for_each_entry_safe(pos, _n, &rbt, node)
154 kfree(pos);
155

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip