lkml.org 
[lkml]   [2022]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
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
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/202208310714.iEB29eJf-lkp@intel.com/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 <lkp@intel.com>

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

\
 
 \ /
  Last update: 2022-08-31 01:42    [W:0.025 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site