linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Can Guo <cang@qti.qualcomm.com>,
	asutoshd@codeaurora.org, nguyenb@codeaurora.org,
	hongwus@codeaurora.org, ziqichen@codeaurora.org,
	linux-scsi@vger.kernel.org, kernel-team@android.com,
	cang@codeaurora.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	Can Guo <cang@qti.qualcomm.com>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>
Subject: Re: [PATCH] scsi: ufs: Fix a possible use before initialization case
Date: Wed, 9 Jun 2021 16:16:39 +0800	[thread overview]
Message-ID: <202106091609.A0sXG2B8-lkp@intel.com> (raw)
In-Reply-To: <1623209820-37840-1-git-send-email-cang@qti.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 7067 bytes --]

Hi Can,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.13-rc5 next-20210608]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Can-Guo/scsi-ufs-Fix-a-possible-use-before-initialization-case/20210609-113857
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a012-20210608 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d2012d965d60c3258b3a69d024491698f8aec386)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/d566879446f64c07b54dfc7ade9d8ef80bf4687a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Can-Guo/scsi-ufs-Fix-a-possible-use-before-initialization-case/20210609-113857
        git checkout d566879446f64c07b54dfc7ade9d8ef80bf4687a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/scsi/ufs/ufshcd.c:2993:1: warning: unused label 'out' [-Wunused-label]
   out:
   ^~~~
   1 warning generated.


vim +/out +2993 drivers/scsi/ufs/ufshcd.c

5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2938  
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2939  /**
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2940   * ufshcd_exec_dev_cmd - API for sending device management requests
8aa29f192ca675 Bart Van Assche    2018-03-01  2941   * @hba: UFS hba
8aa29f192ca675 Bart Van Assche    2018-03-01  2942   * @cmd_type: specifies the type (NOP, Query...)
8aa29f192ca675 Bart Van Assche    2018-03-01  2943   * @timeout: time in seconds
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2944   *
68078d5cc1a59b Dolev Raviv        2013-07-30  2945   * NOTE: Since there is only one available tag for device management commands,
68078d5cc1a59b Dolev Raviv        2013-07-30  2946   * it is expected you hold the hba->dev_cmd.lock mutex.
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2947   */
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2948  static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2949  		enum dev_cmd_type cmd_type, int timeout)
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2950  {
7252a3603015f1 Bart Van Assche    2019-12-09  2951  	struct request_queue *q = hba->cmd_queue;
7252a3603015f1 Bart Van Assche    2019-12-09  2952  	struct request *req;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2953  	struct ufshcd_lrb *lrbp;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2954  	int err;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2955  	int tag;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2956  	struct completion wait;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2957  
a3cd5ec55f6c72 Subhash Jadavani   2017-02-03  2958  	down_read(&hba->clk_scaling_lock);
a3cd5ec55f6c72 Subhash Jadavani   2017-02-03  2959  
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2960  	/*
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2961  	 * Get free slot, sleep if slots are unavailable.
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2962  	 * Even though we use wait_event() which sleeps indefinitely,
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2963  	 * the maximum wait time is bounded by SCSI request timeout.
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2964  	 */
7252a3603015f1 Bart Van Assche    2019-12-09  2965  	req = blk_get_request(q, REQ_OP_DRV_OUT, 0);
bb14dd1564c90d Dan Carpenter      2019-12-13  2966  	if (IS_ERR(req)) {
bb14dd1564c90d Dan Carpenter      2019-12-13  2967  		err = PTR_ERR(req);
bb14dd1564c90d Dan Carpenter      2019-12-13  2968  		goto out_unlock;
bb14dd1564c90d Dan Carpenter      2019-12-13  2969  	}
7252a3603015f1 Bart Van Assche    2019-12-09  2970  	tag = req->tag;
7252a3603015f1 Bart Van Assche    2019-12-09  2971  	WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag));
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2972  
a45f937110fa6b Can Guo            2021-05-24  2973  	if (unlikely(test_bit(tag, &hba->outstanding_reqs))) {
7a7e66c65d4148 Can Guo            2020-12-02  2974  		err = -EBUSY;
d566879446f64c Can Guo            2021-06-08  2975  		goto out_put_tag;
7a7e66c65d4148 Can Guo            2020-12-02  2976  	}
7a7e66c65d4148 Can Guo            2020-12-02  2977  
a45f937110fa6b Can Guo            2021-05-24  2978  	init_completion(&wait);
a45f937110fa6b Can Guo            2021-05-24  2979  	lrbp = &hba->lrb[tag];
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2980  	WARN_ON(lrbp->cmd);
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2981  	err = ufshcd_compose_dev_cmd(hba, lrbp, cmd_type, tag);
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2982  	if (unlikely(err))
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2983  		goto out_put_tag;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2984  
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2985  	hba->dev_cmd.complete = &wait;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2986  
fb475b74d6630e Avri Altman        2021-01-10  2987  	ufshcd_add_query_upiu_trace(hba, UFS_QUERY_SEND, lrbp->ucd_req_ptr);
e3dfdc532d5c68 Yaniv Gardi        2016-02-01  2988  	/* Make sure descriptors are ready before ringing the doorbell */
e3dfdc532d5c68 Yaniv Gardi        2016-02-01  2989  	wmb();
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2990  
a45f937110fa6b Can Guo            2021-05-24  2991  	ufshcd_send_command(hba, tag);
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2992  	err = ufshcd_wait_for_dev_cmd(hba, lrbp, timeout);
7a7e66c65d4148 Can Guo            2020-12-02 @2993  out:
fb475b74d6630e Avri Altman        2021-01-10  2994  	ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR : UFS_QUERY_COMP,
fb475b74d6630e Avri Altman        2021-01-10  2995  				    (struct utp_upiu_req *)lrbp->ucd_rsp_ptr);
6667e6d91c88a7 Ohad Sharabi       2018-03-28  2996  
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  2997  out_put_tag:
7252a3603015f1 Bart Van Assche    2019-12-09  2998  	blk_put_request(req);
bb14dd1564c90d Dan Carpenter      2019-12-13  2999  out_unlock:
a3cd5ec55f6c72 Subhash Jadavani   2017-02-03  3000  	up_read(&hba->clk_scaling_lock);
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  3001  	return err;
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  3002  }
5a0b0cb9bee767 Sujit Reddy Thumma 2013-07-30  3003  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 44723 bytes --]

      parent reply	other threads:[~2021-06-09  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  3:36 [PATCH] scsi: ufs: Fix a possible use before initialization case Can Guo
2021-06-09  6:29 ` Stanley Chu
2021-06-09  8:16 ` kernel test robot [this message]

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=202106091609.A0sXG2B8-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=cang@codeaurora.org \
    --cc=cang@qti.qualcomm.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hongwus@codeaurora.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kernel-team@android.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nguyenb@codeaurora.org \
    --cc=ziqichen@codeaurora.org \
    /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;
as well as URLs for NNTP newsgroup(s).