mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: Greg KH <greg@kroah.com>
Cc: <vincent.sunplus@gmail.com>, <vkoul@kernel.org>,
	<kishon@kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-phy@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] phy: usb: sunplus: Fix memleak in update_disc_vol()
Date: Tue, 8 Nov 2022 15:05:46 +0800	[thread overview]
Message-ID: <44ebb350-fb5b-38f6-8950-98bc80963994@huawei.com> (raw)
In-Reply-To: <Y2n5fhFq4ozEzlBL@kroah.com>

On 2022/11/8 14:38, Greg KH wrote:

> On Tue, Nov 08, 2022 at 02:11:13PM +0800, YueHaibing wrote:
>> 'otp_v' is allocated in nvmem_cell_read(), it should be freed
>> before return.
>>
>> Fixes: 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/phy/sunplus/phy-sunplus-usb2.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/phy/sunplus/phy-sunplus-usb2.c b/drivers/phy/sunplus/phy-sunplus-usb2.c
>> index e827b79f6d49..450cf8e6d7fb 100644
>> --- a/drivers/phy/sunplus/phy-sunplus-usb2.c
>> +++ b/drivers/phy/sunplus/phy-sunplus-usb2.c
>> @@ -96,6 +96,7 @@ static int update_disc_vol(struct sp_usbphy *usbphy)
>>  		set = *(otp_v + 1);
>>  		set = (set << (sizeof(char) * 8)) | *otp_v;
>>  		set = (set >> usbphy->disc_vol_addr_off) & J_DISC;
>> +		kfree(otp_v);
>>  	}
>>  
>>  	if (IS_ERR(otp_v) || set == 0)
> How did you test this?
>
> Just by looking at this tiny diff, this seems to be wrong, please fix
> your tools and your review process to catch errors like this.

sorry,  I misread the code, will be more careful next time.

>
> thanks,
>
> greg k-h
> .

      reply	other threads:[~2022-11-08  7:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  6:11 YueHaibing
2022-11-08  6:38 ` Greg KH
2022-11-08  7:05   ` YueHaibing [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=44ebb350-fb5b-38f6-8950-98bc80963994@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=greg@kroah.com \
    --cc=kishon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=vincent.sunplus@gmail.com \
    --cc=vkoul@kernel.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

all inboxes | Powered by JetHome®