[oracle-dtrace:v1/5.15 30/35] net/ipv4/raw.c:358:21: warning: variable 'dropreason' set but not used
From: kernel test robot
Date: Mon Nov 08 2021 - 22:08:08 EST
tree: https://github.com/oracle/dtrace-linux-kernel v1/5.15
head: 0fee66d7ce96317146609675767971d0f35c3e74
commit: 7ed2333cfd691c676b0adfe951d92244f1ef5128 [30/35] dtrace: add SDT probes
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
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
# https://github.com/oracle/dtrace-linux-kernel/commit/7ed2333cfd691c676b0adfe951d92244f1ef5128
git remote add oracle-dtrace https://github.com/oracle/dtrace-linux-kernel
git fetch --no-tags oracle-dtrace v1/5.15
git checkout 7ed2333cfd691c676b0adfe951d92244f1ef5128
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64
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/raw.c: In function 'raw_send_hdrinc':
>> net/ipv4/raw.c:358:21: warning: variable 'dropreason' set but not used [-Wunused-but-set-variable]
358 | const char *dropreason;
| ^~~~~~~~~~
--
net/ipv4/ip_input.c: In function 'ip_rcv_options':
>> net/ipv4/ip_input.c:273:21: warning: variable 'dropreason' set but not used [-Wunused-but-set-variable]
273 | const char *dropreason;
| ^~~~~~~~~~
net/ipv4/ip_input.c: In function 'ip_rcv_core':
net/ipv4/ip_input.c:468:21: warning: variable 'dropreason' set but not used [-Wunused-but-set-variable]
468 | const char *dropreason = "header invalid";
| ^~~~~~~~~~
--
net/ipv4/ip_output.c: In function '__ip_append_data':
>> net/ipv4/ip_output.c:979:21: warning: variable 'dropreason' set but not used [-Wunused-but-set-variable]
979 | const char *dropreason;
| ^~~~~~~~~~
net/ipv4/ip_output.c: In function 'ip_append_page':
net/ipv4/ip_output.c:1366:21: warning: variable 'dropreason' set but not used [-Wunused-but-set-variable]
1366 | const char *dropreason;
| ^~~~~~~~~~
>> net/ipv4/ip_output.c:1365:23: warning: variable 'iph' set but not used [-Wunused-but-set-variable]
1365 | struct iphdr *iph;
| ^~~
vim +/dropreason +358 net/ipv4/raw.c
344
345 static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
346 struct msghdr *msg, size_t length,
347 struct rtable **rtp, unsigned int flags,
348 const struct sockcm_cookie *sockc)
349 {
350 struct inet_sock *inet = inet_sk(sk);
351 struct net *net = sock_net(sk);
352 struct iphdr *iph;
353 struct sk_buff *skb = NULL;
354 unsigned int iphlen;
355 int err;
356 struct rtable *rt = *rtp;
357 int hlen, tlen;
> 358 const char *dropreason;
359
360 if (length > rt->dst.dev->mtu) {
361 ip_local_error(sk, EMSGSIZE, fl4->daddr, inet->inet_dport,
362 rt->dst.dev->mtu);
363 dropreason = "packet too big";
364 err = -EMSGSIZE;
365 goto trace_drop;
366 }
367 if (length < sizeof(struct iphdr)) {
368 dropreason = "packet too short";
369 err = -EINVAL;
370 goto trace_drop;
371 }
372
373 if (flags&MSG_PROBE)
374 goto out;
375
376 hlen = LL_RESERVED_SPACE(rt->dst.dev);
377 tlen = rt->dst.dev->needed_tailroom;
378 skb = sock_alloc_send_skb(sk,
379 length + hlen + tlen + 15,
380 flags & MSG_DONTWAIT, &err);
381 if (!skb) {
382 dropreason = "out of memory";
383 goto error;
384 }
385 skb_reserve(skb, hlen);
386
387 skb->priority = sk->sk_priority;
388 skb->mark = sockc->mark;
389 skb->tstamp = sockc->transmit_time;
390 skb_dst_set(skb, &rt->dst);
391 *rtp = NULL;
392
393 skb_reset_network_header(skb);
394 iph = ip_hdr(skb);
395 skb_put(skb, length);
396
397 skb->ip_summed = CHECKSUM_NONE;
398
399 skb_setup_tx_timestamp(skb, sockc->tsflags);
400
401 if (flags & MSG_CONFIRM)
402 skb_set_dst_pending_confirm(skb, 1);
403
404 skb->transport_header = skb->network_header;
405 err = -EFAULT;
406 if (memcpy_from_msg(iph, msg, length)) {
407 dropreason = "could not copy msg";
408 goto error_free;
409 }
410
411 iphlen = iph->ihl * 4;
412
413 /*
414 * We don't want to modify the ip header, but we do need to
415 * be sure that it won't cause problems later along the network
416 * stack. Specifically we want to make sure that iph->ihl is a
417 * sane value. If ihl points beyond the length of the buffer passed
418 * in, reject the frame as invalid
419 */
420 err = -EINVAL;
421 if (iphlen > length) {
422 dropreason = "IP header too big";
423 goto error_free;
424 }
425
426 if (iphlen >= sizeof(*iph)) {
427 if (!iph->saddr)
428 iph->saddr = fl4->saddr;
429 iph->check = 0;
430 iph->tot_len = htons(length);
431 if (!iph->id)
432 ip_select_ident(net, skb, NULL);
433
434 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
435 skb->transport_header += iphlen;
436 if (iph->protocol == IPPROTO_ICMP &&
437 length >= iphlen + sizeof(struct icmphdr))
438 icmp_out_count(net, ((struct icmphdr *)
439 skb_transport_header(skb))->type);
440 }
441
442 DTRACE_IP(send,
443 struct sk_buff * : pktinfo_t *, skb,
444 struct sock * : csinfo_t *, sk,
445 void_ip_t * : ipinfo_t *, iph,
446 struct net_device * : ifinfo_t *, skb->dev,
447 struct iphdr * : ipv4info_t *, iph,
448 struct ipv6hdr * : ipv6info_t *, NULL);
449
450 err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT,
451 net, sk, skb, NULL, rt->dst.dev,
452 dst_output);
453 if (err > 0)
454 err = net_xmit_errno(err);
455 if (err) {
456 dropreason = "device dropping packets of this priority";
457 goto error;
458 }
459 out:
460 return 0;
461
462 error_free:
463 kfree_skb(skb);
464 skb = NULL;
465 error:
466 IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS);
467 trace_drop:
468 DTRACE_IP(drop__out,
469 struct sk_buff * : pktinfo_t *, skb,
470 struct sock * : csinfo_t *, skb ? skb->sk : NULL,
471 void_ip_t * : ipinfo_t *, skb ? ip_hdr(skb) : NULL,
472 struct net_device * : ifinfo_t *, skb ? skb->dev : NULL,
473 struct iphdr * : ipv4info_t *, skb ? ip_hdr(skb) : NULL,
474 struct ipv6hdr * : ipv6info_t *, NULL,
475 const char * : string, dropreason);
476 if (err == -ENOBUFS && !inet->recverr)
477 err = 0;
478 return err;
479 }
480
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip