Re: [PATCH] scsi: ufs: Fix a possible use before initialization case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux