Re: [PATCH] net/ipv4/ip_fragment:fix missing Flags reserved bit set in iphdr
From: kernel test robot
Date: Wed May 05 2021 - 13:49:46 EST
Hi meijusan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on ipvs/master]
[also build test WARNING on linus/master sparc-next/master v5.12 next-20210505]
[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/meijusan/net-ipv4-ip_fragment-fix-missing-Flags-reserved-bit-set-in-iphdr/20210505-212826
base: https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
config: x86_64-randconfig-a014-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/c6cde148fcd3bfdfa4ce7beac56893165236fd4e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review meijusan/net-ipv4-ip_fragment-fix-missing-Flags-reserved-bit-set-in-iphdr/20210505-212826
git checkout c6cde148fcd3bfdfa4ce7beac56893165236fd4e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> net/ipv4/ip_output.c:644:6: warning: variable 'ip_evil' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ntohs(iph->frag_off) & IP_EVIL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/byteorder/generic.h:142:18: note: expanded from macro 'ntohs'
#define ntohs(x) ___ntohs(x)
^
include/linux/byteorder/generic.h:137:21: note: expanded from macro '___ntohs'
#define ___ntohs(x) __be16_to_cpu(x)
^
include/uapi/linux/byteorder/little_endian.h:42:26: note: expanded from macro '__be16_to_cpu'
#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
^
include/uapi/linux/swab.h:102:21: note: expanded from macro '__swab16'
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
^
net/ipv4/ip_output.c:655:6: note: uninitialized use occurs here
if (ip_evil)
^~~~~~~
net/ipv4/ip_output.c:644:2: note: remove the 'if' if its condition is always true
if (ntohs(iph->frag_off) & IP_EVIL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv4/ip_output.c:636:14: note: initialize the variable 'ip_evil' to silence this warning
bool ip_evil;
^
= 0
1 warning generated.
vim +644 net/ipv4/ip_output.c
630
631 void ip_fraglist_prepare(struct sk_buff *skb, struct ip_fraglist_iter *iter)
632 {
633 unsigned int hlen = iter->hlen;
634 struct iphdr *iph = iter->iph;
635 struct sk_buff *frag;
636 bool ip_evil;
637
638 frag = iter->frag;
639 frag->ip_summed = CHECKSUM_NONE;
640 skb_reset_transport_header(frag);
641 __skb_push(frag, hlen);
642 skb_reset_network_header(frag);
643 memcpy(skb_network_header(frag), iph, hlen);
> 644 if (ntohs(iph->frag_off) & IP_EVIL)
645 ip_evil = true;
646 iter->iph = ip_hdr(frag);
647 iph = iter->iph;
648 iph->tot_len = htons(frag->len);
649 ip_copy_metadata(frag, skb);
650 iter->offset += skb->len - hlen;
651 iph->frag_off = htons(iter->offset >> 3);
652 if (frag->next)
653 iph->frag_off |= htons(IP_MF);
654
655 if (ip_evil)
656 iph->frag_off |= htons(IP_EVIL);
657
658 /* Ready, complete checksum */
659 ip_send_check(iph);
660 }
661 EXPORT_SYMBOL(ip_fraglist_prepare);
662
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip