mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rong Chen <rong.a.chen@intel.com>
To: Chuck Lever <chuck.lever@oracle.com>, kbuild test robot <lkp@intel.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: Re: [kbuild-all] Re: net/sunrpc/svcsock.c:527:32: warning: Variable 'uninitialized_var' is assigned a value that is never used. [unreadVariable]
Date: Thu, 9 Apr 2020 11:04:00 +0800	[thread overview]
Message-ID: <2342285b-3bb6-32cd-2611-264bc0773150@intel.com> (raw)
In-Reply-To: <76A08BC7-C37A-495D-998A-2E9DADF454A7@oracle.com>



On 4/9/20 5:35 AM, Chuck Lever wrote:
>
>> On Apr 8, 2020, at 5:32 PM, kbuild test robot <lkp@intel.com> wrote:
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   f5e94d10e4c468357019e5c28d48499f677b284f
>> commit: da1661b93bf489cdbc8bcea919b165d31b4810bf SUNRPC: Teach server to use xprt_sock_sendmsg for socket sends
>> date:   3 weeks ago
>>
>> If you fix the issue, kindly add following tag as appropriate
>> Reported-by: kbuild test robot <lkp@intel.com>
>>
>>
>> cppcheck warnings: (new ones prefixed by >>)
>>
>>    net/sunrpc/svcsock.c:405:9: warning: union member 'Anonymous0::all' is never used. [unusedStructMember]
>>      long  all[SVC_PKTINFO_SPACE / sizeof(long)];
>>            ^
>>    net/sunrpc/svcsock.c:518:9: warning: union member 'Anonymous1::all' is never used. [unusedStructMember]
>>      long  all[SVC_PKTINFO_SPACE / sizeof(long)];
>>            ^
>>>> net/sunrpc/svcsock.c:527:32: warning: Variable 'uninitialized_var' is assigned a value that is never used. [unreadVariable]
>>     unsigned int uninitialized_var(sent);
>>                                   ^
>>
>> vim +/uninitialized_var +527 net/sunrpc/svcsock.c
>>
>>    504	
>>    505	/**
>>    506	 * svc_udp_sendto - Send out a reply on a UDP socket
>>    507	 * @rqstp: completed svc_rqst
>>    508	 *
>>    509	 * Returns the number of bytes sent, or a negative errno.
>>    510	 */
>>    511	static int svc_udp_sendto(struct svc_rqst *rqstp)
>>    512	{
>>    513		struct svc_xprt *xprt = rqstp->rq_xprt;
>>    514		struct svc_sock	*svsk = container_of(xprt, struct svc_sock, sk_xprt);
>>    515		struct xdr_buf *xdr = &rqstp->rq_res;
>>    516		union {
>>    517			struct cmsghdr	hdr;
>>    518			long		all[SVC_PKTINFO_SPACE / sizeof(long)];
>>    519		} buffer;
>>    520		struct cmsghdr *cmh = &buffer.hdr;
>>    521		struct msghdr msg = {
>>    522			.msg_name	= &rqstp->rq_addr,
>>    523			.msg_namelen	= rqstp->rq_addrlen,
>>    524			.msg_control	= cmh,
>>    525			.msg_controllen	= sizeof(buffer),
>>    526		};
>>> 527		unsigned int uninitialized_var(sent);
>>    528		int err;
>>    529	
>>    530		svc_set_cmsg_data(rqstp, cmh);
>>    531	
>>    532		err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, 0, &sent);
>>    533		xdr_free_bvec(xdr);
>>    534		if (err == -ECONNREFUSED) {
>>    535			/* ICMP error on earlier request. */
>>    536			err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, 0, &sent);
>>    537			xdr_free_bvec(xdr);
>>    538		}
>>    539		if (err < 0)
>>    540			return err;
>>    541		return sent;
> Wha? "sent" is used right here. Can someone explain this warning?

Hi Chuck,

Sorry for the inconvenience, it should be a false warning,
It's every odd that removing uninitialized_var can silence this warning.

Best Regards,
Rong Chen

>
>
>>    542	}
>>    543	
>>
>> ---
>> 0-DAY CI Kernel Test Service, Intel Corporation
>> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> --
> Chuck Lever
>
>
> _______________________________________________
> kbuild-all mailing list -- kbuild-all@lists.01.org
> To unsubscribe send an email to kbuild-all-leave@lists.01.org


  reply	other threads:[~2020-04-09  3:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 21:32 kbuild test robot
2020-04-08 21:35 ` Chuck Lever
2020-04-09  3:04   ` Rong Chen [this message]
2020-04-09 14:38     ` [kbuild-all] " Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2342285b-3bb6-32cd-2611-264bc0773150@intel.com \
    --to=rong.a.chen@intel.com \
    --cc=chuck.lever@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®