public inbox for [email protected]
 help / color / mirror / Atom feed
From: kernel test robot <[email protected]>
To: David Howells <[email protected]>
Cc: [email protected], [email protected],
	Ammar Faizi <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	[email protected]
Subject: [ammarfaizi2-block:dhowells/linux-fs/rxrpc-fixes 1/5] net/rxrpc/peer_event.c:416:6: warning: variable 'peer' is used uninitialized whenever 'if' condition is false
Date: Wed, 31 Aug 2022 07:41:26 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

tree:   https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/rxrpc-fixes
head:   5ba1502ed90c38548d56a41156440fa70aed70ed
commit: b445daa0f2ca96635e9620cef26a72619ce3644a [1/5] rxrpc: Fix ICMP/ICMP6 error handling
config: hexagon-buildonly-randconfig-r006-20220830 (https://download.01.org/0day-ci/archive/20220831/[email protected]/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c7df82e4693c19e3fd2e25c83eb04d9deb7b7b59)
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/ammarfaizi2/linux-block/commit/b445daa0f2ca96635e9620cef26a72619ce3644a
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/rxrpc-fixes
        git checkout b445daa0f2ca96635e9620cef26a72619ce3644a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/rxrpc/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> net/rxrpc/peer_event.c:416:6: warning: variable 'peer' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/rxrpc/peer_event.c:428:17: note: uninitialized use occurs here
           rxrpc_put_peer(peer);
                          ^~~~
   net/rxrpc/peer_event.c:416:2: note: remove the 'if' if its condition is always true
           if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/rxrpc/peer_event.c:391:25: note: initialize the variable 'peer' to silence this warning
           struct rxrpc_peer *peer;
                                  ^
                                   = NULL
   1 warning generated.


vim +416 net/rxrpc/peer_event.c

   382	
   383	/*
   384	 * Handle an error received on the local endpoint.
   385	 */
   386	void rxrpc_error_report(struct sock *sk)
   387	{
   388		struct sock_exterr_skb *serr;
   389		struct sockaddr_rxrpc srx;
   390		struct rxrpc_local *local;
   391		struct rxrpc_peer *peer;
   392		struct sk_buff *skb;
   393	
   394		rcu_read_lock();
   395		local = rcu_dereference_sk_user_data(sk);
   396		if (unlikely(!local)) {
   397			rcu_read_unlock();
   398			return;
   399		}
   400		_enter("%p{%d}", sk, local->debug_id);
   401	
   402		/* Clear the outstanding error value on the socket so that it doesn't
   403		 * cause kernel_sendmsg() to return it later.
   404		 */
   405		sock_error(sk);
   406	
   407		skb = sock_dequeue_err_skb(sk);
   408		if (!skb) {
   409			rcu_read_unlock();
   410			_leave("UDP socket errqueue empty");
   411			return;
   412		}
   413		rxrpc_new_skb(skb, rxrpc_skb_received);
   414		serr = SKB_EXT_ERR(skb);
   415	
 > 416		if (serr->ee.ee_origin == SO_EE_ORIGIN_LOCAL) {
   417			peer = rxrpc_lookup_peer_local_rcu(local, skb, &srx);
   418			if (peer && !rxrpc_get_peer_maybe(peer))
   419				peer = NULL;
   420			if (peer) {
   421				trace_rxrpc_rx_icmp(peer, &serr->ee, &srx);
   422				rxrpc_store_error(peer, serr);
   423			}
   424		}
   425	
   426		rcu_read_unlock();
   427		rxrpc_free_skb(skb, rxrpc_skb_freed);
   428		rxrpc_put_peer(peer);
   429		_leave("");
   430	}
   431	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

                 reply	other threads:[~2022-08-30 23:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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