lkml.org 
[lkml]   [2021]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] rbtree: Expose a test tree to userspace
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-20211019]
[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: hexagon-randconfig-r033-20211019 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b37efed957ed0a0193d80020aefd55cb587dfc1f)
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=clang make.cross W=1 ARCH=hexagon

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 >>):

>> lib/test_rbtree_interface.c:91:9: warning: no previous prototype for function 'cmd_exec' [-Wmissing-prototypes]
ssize_t cmd_exec(struct file *file, const char __user *ubuf, size_t len, loff_t *offp)
^
lib/test_rbtree_interface.c:91:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
ssize_t cmd_exec(struct file *file, const char __user *ubuf, size_t len, loff_t *offp)
^
static
>> lib/test_rbtree_interface.c:138:12: warning: no previous prototype for function 'rbt_if_init' [-Wmissing-prototypes]
int __init rbt_if_init(void)
^
lib/test_rbtree_interface.c:138:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int __init rbt_if_init(void)
^
static
>> lib/test_rbtree_interface.c:149:13: warning: no previous prototype for function 'rbt_if_exit' [-Wmissing-prototypes]
void __exit rbt_if_exit(void)
^
lib/test_rbtree_interface.c:149:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __exit rbt_if_exit(void)
^
static
3 warnings generated.


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@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-10-20 08:47    [W:0.085 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site