Skip to contentSkip to conversation

net/sunrpc/debugfs.c:307:8: note: in expansion of macro 'min'

PATCH Chuck Lever 1 participant 1 message Jun 11, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201506111234.AT1CSPTP%[email protected]

#1 lore raw
Quoted 20 lines · kbuild test robot
tree:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git testing
head:   5a2dd67f38fa155bdd17ff6c3222a77adabdd508
commit: 4a06825839889cc1756d0dd8a52d6b1071ee0263 [20/22] SUNRPC: Transport fault injection
config: mn10300-allmodconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout 4a06825839889cc1756d0dd8a52d6b1071ee0263

 # save the attached .config to linux build tree
 make.cross ARCH=mn10300 

All warnings (new ones prefixed by >>):

In file included from include/linux/list.h:8:0,
from include/linux/wait.h:6,
from include/linux/fs.h:6,
from include/linux/debugfs.h:18,
from net/sunrpc/debugfs.c:7:
net/sunrpc/debugfs.c: In function 'fault_disconnect_write':
include/linux/kernel.h:723:17: warning: comparison of distinct pointer types lacks a cast

Quoted 5 lines
    (void) (&_min1 == &_min2);  \
                   ^
Quoted 1 line
Quoted 1 line

net/sunrpc/debugfs.c:307:8: note: in expansion of macro 'min'

    len = min(len, sizeof(buffer) - 1);
          ^

I’m not sure why min_t() would be needed here. Both “len” and “sizeof” are size_t. Does the subtraction change the type of its result?

I can send you a patch.

Quoted 28 lines

vim +/min +307 net/sunrpc/debugfs.c

291 fault_disconnect_read(struct file *filp, char __user *user_buf,
292 size_t len, loff_t *offset)
293 {
294 char *buffer = (char *)filp->private_data;
295 size_t size;
296
297 size = sprintf(buffer, "%u\n", rpc_inject_disconnect);
298 return simple_read_from_buffer(user_buf, len, offset, buffer, size);
299 }
300
301 static ssize_t
302 fault_disconnect_write(struct file *filp, const char __user *user_buf,
303 size_t len, loff_t *offset)
304 {
305 char buffer[16];
306

Quoted 1 line

307 len = min(len, sizeof(buffer) - 1);

308 if (copy_from_user(buffer, user_buf, len))
309 return -EFAULT;
310 buffer[len] = '\0';
311 if (kstrtouint(buffer, 10, &rpc_inject_disconnect))
312 return -EINVAL;
313 return len;
314 }
315

Quoted 4 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
<.config.txt>

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com