mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: yangxingui <yangxingui@huawei.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	<oe-kbuild@lists.linux.dev>, <john.g.garry@oracle.com>,
	<yanaijie@huawei.com>, <jejb@linux.ibm.com>,
	<martin.petersen@oracle.com>, <damien.lemoal@opensource.wdc.com>
Cc: <lkp@intel.com>, <oe-kbuild-all@lists.linux.dev>,
	<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linuxarm@huawei.com>, <prime.zeng@hisilicon.com>,
	<chenxiang66@hisilicon.com>, <kangfenglong@huawei.com>
Subject: Re: [PATCH v3 1/3] scsi: libsas: Allow smp_execute_task() arguments to be on the stack
Date: Mon, 11 Mar 2024 15:35:29 +0800	[thread overview]
Message-ID: <b2762a93-c8e3-f467-aed6-37c7e124f7c8@huawei.com> (raw)
In-Reply-To: <0cf17536-beba-4a8f-836b-553a9e0d1046@moroto.mountain>



On 2024/3/11 13:42, Dan Carpenter wrote:
> Hi Xingui,
> 
> kernel test robot noticed the following build warnings:
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Xingui-Yang/scsi-libsas-Allow-smp_execute_task-arguments-to-be-on-the-stack/20240307-174215
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
> patch link:    https://lore.kernel.org/r/20240307093733.41222-2-yangxingui%40huawei.com
> patch subject: [PATCH v3 1/3] scsi: libsas: Allow smp_execute_task() arguments to be on the stack
> config: i386-randconfig-141-20240308 (https://download.01.org/0day-ci/archive/20240310/202403102353.jUPi6fOP-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202403102353.jUPi6fOP-lkp@intel.com/
> 
> New smatch warnings:
> drivers/scsi/libsas/sas_expander.c:148 smp_execute_task() warn: possible memory leak of '_req'
> 
> vim +/_req +148 drivers/scsi/libsas/sas_expander.c
> 
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  138  static int smp_execute_task(struct domain_device *dev, void *req, int req_size,
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  139  			    void *resp, int resp_size)
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  140  {
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  141  	struct scatterlist req_sg;
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  142  	struct scatterlist resp_sg;
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  143  	void *_req = kmemdup(req, req_size, GFP_KERNEL);
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  144  	void *_resp = alloc_smp_resp(resp_size);
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  145  	int ret;
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  146
> adfd2325dfc5cf6 Xingui Yang     2024-03-07  147  	if (!_req || !resp)
> adfd2325dfc5cf6 Xingui Yang     2024-03-07 @148  		return -ENOMEM;
> 
> I haven't looked at the callers so I don't know how likely it is for one
> of the allocations to fail and the other succeed...  But it seems
> possible.

Yes, it's possible. This patch has been canceled in v4. Based on John's 
suggestion, if there are plans to resubmit modifications , we will pay 
attention to this, thank you.

Thanks,
Xingui

  reply	other threads:[~2024-03-11  7:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07  9:37 [PATCH v3 0/3] scsi: libsas: Fix disk not being scanned in after being removed Xingui Yang
2024-03-07  9:37 ` [PATCH v3 1/3] scsi: libsas: Allow smp_execute_task() arguments to be on the stack Xingui Yang
2024-03-11  5:42   ` Dan Carpenter
2024-03-11  7:35     ` yangxingui [this message]
2024-03-07  9:37 ` [PATCH v3 2/3] scsi: libsas: Add a helper sas_get_sas_addr_and_dev_type() Xingui Yang
2024-03-07 10:04   ` John Garry
2024-03-07  9:37 ` [PATCH v3 3/3] scsi: libsas: Fix disk not being scanned in after being removed Xingui Yang
2024-03-07 10:08   ` John Garry
2024-03-07 14:17     ` yangxingui
2024-03-07 10:01 ` [PATCH v3 0/3] " John Garry

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=b2762a93-c8e3-f467-aed6-37c7e124f7c8@huawei.com \
    --to=yangxingui@huawei.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=dan.carpenter@linaro.org \
    --cc=jejb@linux.ibm.com \
    --cc=john.g.garry@oracle.com \
    --cc=kangfenglong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lkp@intel.com \
    --cc=martin.petersen@oracle.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=prime.zeng@hisilicon.com \
    --cc=yanaijie@huawei.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®