drivers/net/ethernet/netronome/nfp/crypto/tls.c:477:18: warning: variable 'ipv6h' set but not used

From: kernel test robot
Date: Sat Jul 11 2020 - 17:05:51 EST


Hi Jakub,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1df0d8960499e58963fd6c8ac75e544f2b417b29
commit: 6a35ddc5445a8291ced6247a67977e110275acde nfp: tls: implement the stream sync RX resync
date: 7 months ago
config: i386-randconfig-s002-20200712 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-37-gc9676a3b-dirty
git checkout 6a35ddc5445a8291ced6247a67977e110275acde
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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

All warnings (new ones prefixed by >>):

drivers/net/ethernet/netronome/nfp/crypto/tls.c: In function 'nfp_net_tls_rx_resync_req':
>> drivers/net/ethernet/netronome/nfp/crypto/tls.c:477:18: warning: variable 'ipv6h' set but not used [-Wunused-but-set-variable]
477 | struct ipv6hdr *ipv6h;
| ^~~~~

vim +/ipv6h +477 drivers/net/ethernet/netronome/nfp/crypto/tls.c

470
471 int nfp_net_tls_rx_resync_req(struct net_device *netdev,
472 struct nfp_net_tls_resync_req *req,
473 void *pkt, unsigned int pkt_len)
474 {
475 struct nfp_net *nn = netdev_priv(netdev);
476 struct nfp_net_tls_offload_ctx *ntls;
> 477 struct ipv6hdr *ipv6h;
478 struct tcphdr *th;
479 struct iphdr *iph;
480 struct sock *sk;
481 __be32 tcp_seq;
482 int err;
483
484 iph = pkt + req->l3_offset;
485 ipv6h = pkt + req->l3_offset;
486 th = pkt + req->l4_offset;
487
488 if ((u8 *)&th[1] > (u8 *)pkt + pkt_len) {
489 netdev_warn_once(netdev, "invalid TLS RX resync request (l3_off: %hhu l4_off: %hhu pkt_len: %u)\n",
490 req->l3_offset, req->l4_offset, pkt_len);
491 err = -EINVAL;
492 goto err_cnt_ign;
493 }
494
495 switch (iph->version) {
496 case 4:
497 sk = inet_lookup_established(dev_net(netdev), &tcp_hashinfo,
498 iph->saddr, th->source, iph->daddr,
499 th->dest, netdev->ifindex);
500 break;
501 #if IS_ENABLED(CONFIG_IPV6)
502 case 6:
503 sk = __inet6_lookup_established(dev_net(netdev), &tcp_hashinfo,
504 &ipv6h->saddr, th->source,
505 &ipv6h->daddr, ntohs(th->dest),
506 netdev->ifindex, 0);
507 break;
508 #endif
509 default:
510 netdev_warn_once(netdev, "invalid TLS RX resync request (l3_off: %hhu l4_off: %hhu ipver: %u)\n",
511 req->l3_offset, req->l4_offset, iph->version);
512 err = -EINVAL;
513 goto err_cnt_ign;
514 }
515
516 err = 0;
517 if (!sk)
518 goto err_cnt_ign;
519 if (!tls_is_sk_rx_device_offloaded(sk) ||
520 sk->sk_shutdown & RCV_SHUTDOWN)
521 goto err_put_sock;
522
523 ntls = tls_driver_ctx(sk, TLS_OFFLOAD_CTX_DIR_RX);
524 /* some FW versions can't report the handle and report 0s */
525 if (memchr_inv(&req->fw_handle, 0, sizeof(req->fw_handle)) &&
526 memcmp(&req->fw_handle, &ntls->fw_handle, sizeof(ntls->fw_handle)))
527 goto err_put_sock;
528
529 /* copy to ensure alignment */
530 memcpy(&tcp_seq, &req->tcp_seq, sizeof(tcp_seq));
531 tls_offload_rx_resync_request(sk, tcp_seq);
532 atomic_inc(&nn->ktls_rx_resync_req);
533
534 sock_gen_put(sk);
535 return 0;
536
537 err_put_sock:
538 sock_gen_put(sk);
539 err_cnt_ign:
540 atomic_inc(&nn->ktls_rx_resync_ign);
541 return err;
542 }
543

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

Attachment: .config.gz
Description: application/gzip