Re: [PATCH] iov_iter: Fix out-of-bound access in iov_iter_advance()

From: kbuild test robot
Date: Thu Mar 31 2016 - 22:47:28 EST


Hi Takashi,

[auto build test WARNING on v4.6-rc1]
[also build test WARNING on next-20160331]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url: https://github.com/0day-ci/linux/commits/Takashi-Iwai/iov_iter-Fix-out-of-bound-access-in-iov_iter_advance/20160331-185222
config: ia64-allnoconfig (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
# save the attached .config to linux build tree
make.cross ARCH=ia64

All warnings (new ones prefixed by >>):

lib/iov_iter.c: In function 'iov_iter_advance':
>> lib/iov_iter.c:514:3: warning: 'return' with a value, in function returning void
return 0;
^

vim +/return +514 lib/iov_iter.c

498 __copy_from_user_inatomic((p += v.iov_len) - v.iov_len,
499 v.iov_base, v.iov_len),
500 memcpy_from_page((p += v.bv_len) - v.bv_len, v.bv_page,
501 v.bv_offset, v.bv_len),
502 memcpy((p += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
503 )
504 kunmap_atomic(kaddr);
505 return bytes;
506 }
507 EXPORT_SYMBOL(iov_iter_copy_from_user_atomic);
508
509 void iov_iter_advance(struct iov_iter *i, size_t size)
510 {
511 if (unlikely(size > i->count))
512 size = i->count;
513 if (unlikely(!size))
> 514 return 0;
515 iterate_and_advance(i, size, v, 0, 0, 0)
516 }
517 EXPORT_SYMBOL(iov_iter_advance);
518
519 /*
520 * Return the count of just the current iov_iter segment.
521 */
522 size_t iov_iter_single_seg_count(const struct iov_iter *i)

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

Attachment: .config.gz
Description: Binary data