From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ajay Gupta <ajayg@nvidia.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: ccg: fix memory leak in do_flash
Date: Tue, 28 May 2019 11:06:12 +0300 [thread overview]
Message-ID: <20190528080612.GC7167@kuha.fi.intel.com> (raw)
In-Reply-To: <20190528080452.GB7167@kuha.fi.intel.com>
On Tue, May 28, 2019 at 11:04:52AM +0300, Heikki Krogerus wrote:
> On Mon, May 27, 2019 at 01:10:50PM -0500, Gustavo A. R. Silva wrote:
> > In case memory resources for *fw* were successfully allocated,
> > release them before return.
> >
> > Addresses-Coverity-ID: 1445499 ("Resource leak")
> > Fixes: 5c9ae5a87573 ("usb: typec: ucsi: ccg: add firmware flashing support")
> > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Acked-by: Heikki Krogerus <heikki.krogerus@gmail.com>
That email address does not actually exist :-/. Sorry.
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > ---
> > drivers/usb/typec/ucsi/ucsi_ccg.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/typec/ucsi/ucsi_ccg.c b/drivers/usb/typec/ucsi/ucsi_ccg.c
> > index 9d46aa9e4e35..bf63074675fc 100644
> > --- a/drivers/usb/typec/ucsi/ucsi_ccg.c
> > +++ b/drivers/usb/typec/ucsi/ucsi_ccg.c
> > @@ -862,8 +862,10 @@ static int do_flash(struct ucsi_ccg *uc, enum enum_flash_mode mode)
> >
> > not_signed_fw:
> > wr_buf = kzalloc(CCG4_ROW_SIZE + 4, GFP_KERNEL);
> > - if (!wr_buf)
> > - return -ENOMEM;
> > + if (!wr_buf) {
> > + err = -ENOMEM;
> > + goto release_fw;
> > + }
> >
> > err = ccg_cmd_enter_flashing(uc);
> > if (err)
> > --
> > 2.21.0
--
heikki
prev parent reply other threads:[~2019-05-28 8:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-27 18:10 [PATCH] usb: typec: ucsi: ccg: fix memory leak in do_flash Gustavo A. R. Silva
2019-05-28 8:04 ` Heikki Krogerus
2019-05-28 8:06 ` Heikki Krogerus [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=20190528080612.GC7167@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=ajayg@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.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