From: David Brownell <david-b@pacbell.net>
To: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Daniel Marjamäki" <danielm77@spray.se>,
"David Brownell" <dbrownell@users.sourceforge.net>,
"Greg Kroah-Hartman" <gregkh@suse.de>
Subject: Re: [PATCH] USB: fix possible memory leak in pxa27x_udc
Date: Mon, 23 Jun 2008 15:38:12 -0700 [thread overview]
Message-ID: <200806231538.12199.david-b@pacbell.net> (raw)
In-Reply-To: <20080622090813.GA11823@joi>
On Sunday 22 June 2008, Marcin Slusarz wrote:
> --- a/drivers/usb/gadget/pxa27x_udc.c
> +++ b/drivers/usb/gadget/pxa27x_udc.c
> @@ -650,8 +650,11 @@ pxa_ep_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
> {
> struct pxa27x_request *req;
>
> + if (!_ep)
> + return NULL;
> +
Correct enough as it goes, except that it *can't* be null by virtue
of how it's called. See <include/linux/usb/gadget.h> for:
static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
gfp_t gfp_flags)
{
return ep->ops->alloc_request(ep, gfp_flags);
}
If it were null it couldn't get here. A better fix would just
remove the null check here (and possibly elsewhere).
- Dave
> req = kzalloc(sizeof *req, gfp_flags);
> - if (!req || !_ep)
> + if (!req)
> return NULL;
>
> INIT_LIST_HEAD(&req->queue);
> --
> 1.5.4.5
>
prev parent reply other threads:[~2008-06-23 22:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-22 9:08 [PATCH] USB: fix possible memory leak in pxa27x_udc Marcin Slusarz
2008-06-23 22:38 ` David Brownell [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=200806231538.12199.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=danielm77@spray.se \
--cc=dbrownell@users.sourceforge.net \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.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