[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201804122205.L3ggo0u8%fengguang.wu@intel.com>
Date: Thu, 12 Apr 2018 22:09:43 +0800
From: kbuild test robot <lkp@...el.com>
To: Stephen Suryaputra <ssuryaextr@...il.com>
Cc: kbuild-all@...org, netdev@...r.kernel.org,
Stephen Suryaputra <ssuryaextr@...il.com>
Subject: Re: [PATCH net-next] Per interface IPv4 stats
(CONFIG_IP_IFSTATS_TABLE)
Hi Stephen,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Stephen-Suryaputra/Per-interface-IPv4-stats-CONFIG_IP_IFSTATS_TABLE/20180412-181719
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
net/ipv4/proc.c:414:28: sparse: Variable length array is used.
>> net/ipv4/proc.c:499:43: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] <asn:3>*mib @@ got vvoid [noderef] <asn:3>*mib @@
net/ipv4/proc.c:499:43: expected void [noderef] <asn:3>*mib
net/ipv4/proc.c:499:43: got void [noderef] <asn:3>**pcpumib
>> net/ipv4/proc.c:532:34: sparse: cast removes address space of expression
net/ipv4/proc.c:534:34: sparse: cast removes address space of expression
vim +499 net/ipv4/proc.c
411
412 static int snmp_seq_show_tcp_udp(struct seq_file *seq, void *v)
413 {
> 414 unsigned long buff[TCPUDP_MIB_MAX];
415 struct net *net = seq->private;
416 int i;
417
418 memset(buff, 0, TCPUDP_MIB_MAX * sizeof(unsigned long));
419
420 seq_puts(seq, "\nTcp:");
421 for (i = 0; snmp4_tcp_list[i].name; i++)
422 seq_printf(seq, " %s", snmp4_tcp_list[i].name);
423
424 seq_puts(seq, "\nTcp:");
425 snmp_get_cpu_field_batch(buff, snmp4_tcp_list,
426 net->mib.tcp_statistics);
427 for (i = 0; snmp4_tcp_list[i].name; i++) {
428 /* MaxConn field is signed, RFC 2012 */
429 if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
430 seq_printf(seq, " %ld", buff[i]);
431 else
432 seq_printf(seq, " %lu", buff[i]);
433 }
434
435 memset(buff, 0, TCPUDP_MIB_MAX * sizeof(unsigned long));
436
437 snmp_get_cpu_field_batch(buff, snmp4_udp_list,
438 net->mib.udp_statistics);
439 seq_puts(seq, "\nUdp:");
440 for (i = 0; snmp4_udp_list[i].name; i++)
441 seq_printf(seq, " %s", snmp4_udp_list[i].name);
442 seq_puts(seq, "\nUdp:");
443 for (i = 0; snmp4_udp_list[i].name; i++)
444 seq_printf(seq, " %lu", buff[i]);
445
446 memset(buff, 0, TCPUDP_MIB_MAX * sizeof(unsigned long));
447
448 /* the UDP and UDP-Lite MIBs are the same */
449 seq_puts(seq, "\nUdpLite:");
450 snmp_get_cpu_field_batch(buff, snmp4_udp_list,
451 net->mib.udplite_statistics);
452 for (i = 0; snmp4_udp_list[i].name; i++)
453 seq_printf(seq, " %s", snmp4_udp_list[i].name);
454 seq_puts(seq, "\nUdpLite:");
455 for (i = 0; snmp4_udp_list[i].name; i++)
456 seq_printf(seq, " %lu", buff[i]);
457
458 seq_putc(seq, '\n');
459 return 0;
460 }
461
462 static int snmp_seq_show(struct seq_file *seq, void *v)
463 {
464 snmp_seq_show_ipstats(seq, v);
465
466 icmp_put(seq); /* RFC 2011 compatibility */
467 icmpmsg_put(seq);
468
469 snmp_seq_show_tcp_udp(seq, v);
470
471 return 0;
472 }
473
474 static int snmp_seq_open(struct inode *inode, struct file *file)
475 {
476 return single_open_net(inode, file, snmp_seq_show);
477 }
478
479 static const struct file_operations snmp_seq_fops = {
480 .open = snmp_seq_open,
481 .read = seq_read,
482 .llseek = seq_lseek,
483 .release = single_release_net,
484 };
485
486
487 #ifdef CONFIG_IP_IFSTATS_TABLE
488 static void snmp_seq_show_item(struct seq_file *seq, void __percpu **pcpumib,
489 atomic_long_t *smib,
490 const struct snmp_mib *itemlist,
491 char *prefix)
492 {
493 char name[32];
494 int i;
495 unsigned long val;
496
497 for (i = 0; itemlist[i].name; i++) {
498 val = pcpumib ?
> 499 snmp_fold_field64(pcpumib, itemlist[i].entry,
500 offsetof(struct ipstats_mib, syncp)) :
501 atomic_long_read(smib + itemlist[i].entry);
502 snprintf(name, sizeof(name), "%s%s",
503 prefix, itemlist[i].name);
504 seq_printf(seq, "%-32s\t%lu\n", name, val);
505 }
506 }
507
508 static void snmp_seq_show_icmpmsg(struct seq_file *seq, atomic_long_t *smib)
509 {
510 char name[32];
511 int i;
512 unsigned long val;
513
514 for (i = 0; i < ICMPMSG_MIB_MAX; i++) {
515 val = atomic_long_read(smib + i);
516 if (val) {
517 snprintf(name, sizeof(name), "Icmp%sType%u",
518 i & 0x100 ? "Out" : "In", i & 0xff);
519 seq_printf(seq, "%-32s\t%lu\n", name, val);
520 }
521 }
522 }
523
524 static int snmp_dev_seq_show(struct seq_file *seq, void *v)
525 {
526 struct in_device *idev = (struct in_device *)seq->private;
527
528 seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex);
529
530 BUILD_BUG_ON(offsetof(struct ipstats_mib, mibs) != 0);
531
> 532 snmp_seq_show_item(seq, (void __percpu **)idev->stats.ip, NULL,
533 snmp4_ipstats_list, "Ip");
534 snmp_seq_show_item(seq, (void __percpu **)idev->stats.ip, NULL,
535 snmp4_ipextstats_list, "Ip");
536 snmp_seq_show_item(seq, NULL, idev->stats.icmpdev->mibs,
537 snmp4_icmp_list, "Icmp");
538 snmp_seq_show_icmpmsg(seq, idev->stats.icmpmsgdev->mibs);
539 return 0;
540 }
541
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Powered by blists - more mailing lists