Message ID | 1445602236-24130-10-git-send-email-clabbe.montjoie@gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: xtensa-allyesconfig (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=xtensa
All warnings (new ones prefixed by >>):
In file included from include/linux/uio.h:12:0,
from include/linux/socket.h:7,
from net/ipv6/raw.c:23:
net/ipv6/raw.c: In function 'raw6_getfrag':
include/linux/kernel.h:722:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_min1 == &_min2); \
^
>> net/ipv6/raw.c:708:14: note: in expansion of macro 'min'
int copy = min(rfv->hlen - offset, len);
^
vim +/min +708 net/ipv6/raw.c
^1da177e Linus Torvalds 2005-04-16 692 break;
6e8f4d48 Masahide NAKAMURA 2006-08-23 693 case IPPROTO_MH:
19e3c66b Al Viro 2014-11-24 694 rfv->hlen = 4;
19e3c66b Al Viro 2014-11-24 695 err = memcpy_from_msg(rfv->c, rfv->msg, rfv->hlen);
19e3c66b Al Viro 2014-11-24 696 if (!err)
19e3c66b Al Viro 2014-11-24 697 fl6->fl6_mh_type = rfv->c[2];
^1da177e Linus Torvalds 2005-04-16 698 }
19e3c66b Al Viro 2014-11-24 699 return err;
^1da177e Linus Torvalds 2005-04-16 700 }
19e3c66b Al Viro 2014-11-24 701
19e3c66b Al Viro 2014-11-24 702 static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
19e3c66b Al Viro 2014-11-24 703 struct sk_buff *skb)
19e3c66b Al Viro 2014-11-24 704 {
19e3c66b Al Viro 2014-11-24 705 struct raw6_frag_vec *rfv = from;
19e3c66b Al Viro 2014-11-24 706
19e3c66b Al Viro 2014-11-24 707 if (offset < rfv->hlen) {
19e3c66b Al Viro 2014-11-24 @708 int copy = min(rfv->hlen - offset, len);
19e3c66b Al Viro 2014-11-24 709
19e3c66b Al Viro 2014-11-24 710 if (skb->ip_summed == CHECKSUM_PARTIAL)
19e3c66b Al Viro 2014-11-24 711 memcpy(to, rfv->c + offset, copy);
19e3c66b Al Viro 2014-11-24 712 else
19e3c66b Al Viro 2014-11-24 713 skb->csum = csum_block_add(
19e3c66b Al Viro 2014-11-24 714 skb->csum,
19e3c66b Al Viro 2014-11-24 715 csum_partial_copy_nocheck(rfv->c + offset,
19e3c66b Al Viro 2014-11-24 716 to, copy, 0),
:::::: The code at line 708 was first introduced by commit
:::::: 19e3c66b52caf20a9a1119dc847b6abae4c03f4f ipv6 equivalent of "ipv4: Avoid reading user iov twice after raw_probe_proto_opt"
:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi LABBE,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/LABBE-Corentin/net-change-len-parameter-type-for-memcpy_-to-from-_msg/20151023-201642
config: tile-allyesconfig (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=tile
All warnings (new ones prefixed by >>):
net/ipv6/raw.c: In function 'raw6_getfrag':
>> net/ipv6/raw.c:708:14: warning: comparison of distinct pointer types lacks a cast [enabled by default]
vim +708 net/ipv6/raw.c
^1da177e Linus Torvalds 2005-04-16 692 break;
6e8f4d48 Masahide NAKAMURA 2006-08-23 693 case IPPROTO_MH:
19e3c66b Al Viro 2014-11-24 694 rfv->hlen = 4;
19e3c66b Al Viro 2014-11-24 695 err = memcpy_from_msg(rfv->c, rfv->msg, rfv->hlen);
19e3c66b Al Viro 2014-11-24 696 if (!err)
19e3c66b Al Viro 2014-11-24 697 fl6->fl6_mh_type = rfv->c[2];
^1da177e Linus Torvalds 2005-04-16 698 }
19e3c66b Al Viro 2014-11-24 699 return err;
^1da177e Linus Torvalds 2005-04-16 700 }
19e3c66b Al Viro 2014-11-24 701
19e3c66b Al Viro 2014-11-24 702 static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
19e3c66b Al Viro 2014-11-24 703 struct sk_buff *skb)
19e3c66b Al Viro 2014-11-24 704 {
19e3c66b Al Viro 2014-11-24 705 struct raw6_frag_vec *rfv = from;
19e3c66b Al Viro 2014-11-24 706
19e3c66b Al Viro 2014-11-24 707 if (offset < rfv->hlen) {
19e3c66b Al Viro 2014-11-24 @708 int copy = min(rfv->hlen - offset, len);
19e3c66b Al Viro 2014-11-24 709
19e3c66b Al Viro 2014-11-24 710 if (skb->ip_summed == CHECKSUM_PARTIAL)
19e3c66b Al Viro 2014-11-24 711 memcpy(to, rfv->c + offset, copy);
19e3c66b Al Viro 2014-11-24 712 else
19e3c66b Al Viro 2014-11-24 713 skb->csum = csum_block_add(
19e3c66b Al Viro 2014-11-24 714 skb->csum,
19e3c66b Al Viro 2014-11-24 715 csum_partial_copy_nocheck(rfv->c + offset,
19e3c66b Al Viro 2014-11-24 716 to, copy, 0),
:::::: The code at line 708 was first introduced by commit
:::::: 19e3c66b52caf20a9a1119dc847b6abae4c03f4f ipv6 equivalent of "ipv4: Avoid reading user iov twice after raw_probe_proto_opt"
:::::: TO: Al Viro <viro@zeniv.linux.org.uk>
:::::: CC: Al Viro <viro@zeniv.linux.org.uk>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 5d9404b..434e9ad 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -618,7 +618,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, size_t length, struct sk_buff *skb; int err; struct rt6_info *rt = (struct rt6_info *)*dstp; - int hlen = LL_RESERVED_SPACE(rt->dst.dev); + size_t hlen = LL_RESERVED_SPACE(rt->dst.dev); int tlen = rt->dst.dev->needed_tailroom; if (length > rt->dst.dev->mtu) { @@ -674,7 +674,7 @@ error: struct raw6_frag_vec { struct msghdr *msg; - int hlen; + size_t hlen; char c[4]; };
The hlen member of raw6_frag_vec is used in operation/function that wait for unsigned value. So it need to be set as size_t. This patch do the same for the hlen variable. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> --- net/ipv6/raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)