Re: [PATCH] netfilter: conntrack: fix -Wformat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on nf-next/master]
[also build test WARNING on nf/master ipvs/master v5.10-rc3 next-20201109]
[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/Nick-Desaulniers/netfilter-conntrack-fix-Wformat/20201109-085104
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: riscv-randconfig-s031-20201109 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-76-gf680124b-dirty
        # https://github.com/0day-ci/linux/commit/407a53117fa32f8f17a73a51bced0e85f168acb4
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nick-Desaulniers/netfilter-conntrack-fix-Wformat/20201109-085104
        git checkout 407a53117fa32f8f17a73a51bced0e85f168acb4
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


"sparse warnings: (new ones prefixed by >>)"
>> net/netfilter/nf_conntrack_standalone.c:56:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:60:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:61:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:66:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:67:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:72:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:73:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:77:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:78:29: sparse: sparse: cast to restricted __be16
   net/netfilter/nf_conntrack_standalone.c:84:29: sparse: sparse: cast to restricted __be16

vim +56 net/netfilter/nf_conntrack_standalone.c

    32	
    33	#ifdef CONFIG_NF_CONNTRACK_PROCFS
    34	void
    35	print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
    36	            const struct nf_conntrack_l4proto *l4proto)
    37	{
    38		switch (tuple->src.l3num) {
    39		case NFPROTO_IPV4:
    40			seq_printf(s, "src=%pI4 dst=%pI4 ",
    41				   &tuple->src.u3.ip, &tuple->dst.u3.ip);
    42			break;
    43		case NFPROTO_IPV6:
    44			seq_printf(s, "src=%pI6 dst=%pI6 ",
    45				   tuple->src.u3.ip6, tuple->dst.u3.ip6);
    46			break;
    47		default:
    48			break;
    49		}
    50	
    51		switch (l4proto->l4proto) {
    52		case IPPROTO_ICMP:
    53			seq_printf(s, "type=%u code=%u id=%hu ",
    54				   tuple->dst.u.icmp.type,
    55				   tuple->dst.u.icmp.code,
  > 56				   (__be16)ntohs(tuple->src.u.icmp.id));
    57			break;
    58		case IPPROTO_TCP:
    59			seq_printf(s, "sport=%hu dport=%hu ",
    60				   (__be16)ntohs(tuple->src.u.tcp.port),
    61				   (__be16)ntohs(tuple->dst.u.tcp.port));
    62			break;
    63		case IPPROTO_UDPLITE:
    64		case IPPROTO_UDP:
    65			seq_printf(s, "sport=%hu dport=%hu ",
    66				   (__be16)ntohs(tuple->src.u.udp.port),
    67				   (__be16)ntohs(tuple->dst.u.udp.port));
    68	
    69			break;
    70		case IPPROTO_DCCP:
    71			seq_printf(s, "sport=%hu dport=%hu ",
    72				   (__be16)ntohs(tuple->src.u.dccp.port),
    73				   (__be16)ntohs(tuple->dst.u.dccp.port));
    74			break;
    75		case IPPROTO_SCTP:
    76			seq_printf(s, "sport=%hu dport=%hu ",
    77				   (__be16)ntohs(tuple->src.u.sctp.port),
    78				   (__be16)ntohs(tuple->dst.u.sctp.port));
    79			break;
    80		case IPPROTO_ICMPV6:
    81			seq_printf(s, "type=%u code=%u id=%hu ",
    82				   tuple->dst.u.icmp.type,
    83				   tuple->dst.u.icmp.code,
    84				   (__be16)ntohs(tuple->src.u.icmp.id));
    85			break;
    86		case IPPROTO_GRE:
    87			seq_printf(s, "srckey=0x%x dstkey=0x%x ",
    88				   ntohs(tuple->src.u.gre.key),
    89				   ntohs(tuple->dst.u.gre.key));
    90			break;
    91		default:
    92			break;
    93		}
    94	}
    95	EXPORT_SYMBOL_GPL(print_tuple);
    96	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux