All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hansverk@cisco.com>
To: Ethan Zhao <ethan.kernel@gmail.com>
Cc: hans.verkuil@cisco.com, m.chehab@samsung.com,
	gregkh@linuxfoundation.org,
	linux-media <linux-media@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs()
Date: Fri, 10 Jan 2014 14:07:32 +0100	[thread overview]
Message-ID: <52CFF094.5080408@cisco.com> (raw)
In-Reply-To: <1389088562-463-1-git-send-email-ethan.kernel@gmail.com>

Cc to linux-media and Hans de Goede (gspca maintainer).

Regards,

	Hans

On 01/07/14 10:56, Ethan Zhao wrote:
> function alt_xfer() may return NULL, should check its return value passed into
> create_urbs() as parameter.
> 
> gspca_init_transfer()
> {
> ... ...
> ret = create_urbs(gspca_dev,alt_xfer(&intf->altsetting[alt], xfer));
> ... ...
> }
> 
> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
> ---
>  drivers/media/usb/gspca/gspca.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
> index 048507b..eb45bc0 100644
> --- a/drivers/media/usb/gspca/gspca.c
> +++ b/drivers/media/usb/gspca/gspca.c
> @@ -761,6 +761,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
>  	struct urb *urb;
>  	int n, nurbs, i, psize, npkt, bsize;
>  
> +	if (!ep)
> +		return -EINVAL;
>  	/* calculate the packet size and the number of packets */
>  	psize = le16_to_cpu(ep->desc.wMaxPacketSize);
>  
> 

  reply	other threads:[~2014-01-10 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  9:56 [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs() Ethan Zhao
2014-01-10 13:07 ` Hans Verkuil [this message]
2014-01-10 15:01   ` Hans de Goede

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=52CFF094.5080408@cisco.com \
    --to=hansverk@cisco.com \
    --cc=ethan.kernel@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hans.verkuil@cisco.com \
    --cc=hdegoede@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.