mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, David Howells <dhowells@redhat.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: fs/afs/server.c:406 afs_put_server() warn: variable dereferenced before check 'server' (see line 402)
Date: Mon, 15 Aug 2022 11:28:15 +0300	[thread overview]
Message-ID: <202208151006.5QHVQK8p-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   568035b01cfb107af8d2e4bd2fb9aea22cf5b868
commit: 2757a4dc184997c66ef1de32636f73b9f21aac14 afs: Fix access after dec in put functions
config: parisc-randconfig-m031-20220807 (https://download.01.org/0day-ci/archive/20220815/202208151006.5QHVQK8p-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/afs/server.c:406 afs_put_server() warn: variable dereferenced before check 'server' (see line 402)

vim +/server +406 fs/afs/server.c

452181936931f0 David Howells  2019-06-20  399  void afs_put_server(struct afs_net *net, struct afs_server *server,
452181936931f0 David Howells  2019-06-20  400  		    enum afs_server_trace reason)
^1da177e4c3f41 Linus Torvalds 2005-04-16  401  {
2757a4dc184997 David Howells  2022-07-06 @402  	unsigned int a, debug_id = server->debug_id;
                                                                           ^^^^^^^^^^^^^^^^
Dereferenced

c56f9ec8b20f93 David Howells  2022-07-06  403  	bool zero;
c56f9ec8b20f93 David Howells  2022-07-06  404  	int r;
d2ddc776a4581d David Howells  2017-11-02  405  
^1da177e4c3f41 Linus Torvalds 2005-04-16 @406  	if (!server)
                                                    ^^^^^^^
Can this check be deleted?

^1da177e4c3f41 Linus Torvalds 2005-04-16  407  		return;
^1da177e4c3f41 Linus Torvalds 2005-04-16  408  
2757a4dc184997 David Howells  2022-07-06  409  	a = atomic_inc_return(&server->active);
c56f9ec8b20f93 David Howells  2022-07-06  410  	zero = __refcount_dec_and_test(&server->ref, &r);
2757a4dc184997 David Howells  2022-07-06  411  	trace_afs_server(debug_id, r - 1, a, reason);
c56f9ec8b20f93 David Howells  2022-07-06  412  	if (unlikely(zero))
977e5f8ed0ab27 David Howells  2020-04-17  413  		__afs_put_server(net, server);
977e5f8ed0ab27 David Howells  2020-04-17  414  }

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


                 reply	other threads:[~2022-08-15  8:29 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 \
    --in-reply-to=202208151006.5QHVQK8p-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=dhowells@redhat.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@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®