From: Sakari Ailus <sakari.ailus@iki.fi>
To: DaeSeok Youn <daeseok.youn@gmail.com>
Cc: m.chehab@samsung.com, linux-dev@sensoray.com,
hans.verkuil@cisco.com, linux-media@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [media] s2255drv: fix memory leak s2255_probe()
Date: Mon, 5 May 2014 11:38:56 +0300 [thread overview]
Message-ID: <20140505083856.GZ8753@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <CAHb8M2CECG7ydo9L2u5BOcQeq8V3=ydy149kCLkoueo+HbD6fg@mail.gmail.com>
On Tue, Apr 15, 2014 at 07:54:43PM +0900, DaeSeok Youn wrote:
> Hi, Sakari
>
> 2014-04-15 18:33 GMT+09:00 Sakari Ailus <sakari.ailus@iki.fi>:
> > Hi Daeseok,
> >
> > On Tue, Apr 15, 2014 at 01:49:34PM +0900, Daeseok Youn wrote:
> >>
> >> smatch says:
> >> drivers/media/usb/s2255/s2255drv.c:2246 s2255_probe() warn:
> >> possible memory leak of 'dev'
> >>
> >> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> >> ---
> >> drivers/media/usb/s2255/s2255drv.c | 1 +
> >> 1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
> >> index 1d4ba2b..8aca3ef 100644
> >> --- a/drivers/media/usb/s2255/s2255drv.c
> >> +++ b/drivers/media/usb/s2255/s2255drv.c
> >> @@ -2243,6 +2243,7 @@ static int s2255_probe(struct usb_interface *interface,
> >> dev->cmdbuf = kzalloc(S2255_CMDBUF_SIZE, GFP_KERNEL);
> >> if (dev->cmdbuf == NULL) {
> >> s2255_dev_err(&interface->dev, "out of memory\n");
> >> + kfree(dev);
> >> return -ENOMEM;
> >> }
> >>
> >
> > The rest of the function already uses goto and labels for error handling. I
> > think it'd take adding one more. dev is correctly released in other error
> > cases.
> I am not sure that adding a new label for error handling when
> allocation for dev->cmdbuf is failed.
> I think it is ok to me. :-) Because I think it is not good adding a
> new label and use goto statement for this.
I can ack this if you use the same pattern for error handling that's already
there.
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
next prev parent reply other threads:[~2014-05-05 8:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 4:49 Daeseok Youn
2014-04-15 9:33 ` Sakari Ailus
2014-04-15 10:54 ` DaeSeok Youn
2014-05-05 8:38 ` Sakari Ailus [this message]
2014-05-07 4:38 ` DaeSeok Youn
2014-05-08 11:21 ` Sakari Ailus
2014-05-08 22:57 Daeseok Youn
2014-05-09 7:32 ` Sakari Ailus
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=20140505083856.GZ8753@valkosipuli.retiisi.org.uk \
--to=sakari.ailus@iki.fi \
--cc=daeseok.youn@gmail.com \
--cc=hans.verkuil@cisco.com \
--cc=linux-dev@sensoray.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.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®