From: Johan Hovold <jhovold@gmail.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Johan Hovold <jhovold@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix for possible null pointer dereference in keyspan.c
Date: Fri, 16 May 2014 17:30:00 +0200 [thread overview]
Message-ID: <20140516153000.GC8213@localhost> (raw)
In-Reply-To: <1400190910-28019-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
On Thu, May 15, 2014 at 11:55:10PM +0200, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
I don't think this can be triggered unless the URB allocation fails at
probe, but let's move the offending line nonetheless.
I'll fix up the patch subject as well.
> Was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/usb/serial/keyspan.c | 4 ++--
> 1 fil ändrad, 2 tillägg(+), 2 borttagningar(-)
Diff stats in Swedish?! :)
Thanks,
Johan
> diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
> index d3acaea..93cb7ce 100644
> --- a/drivers/usb/serial/keyspan.c
> +++ b/drivers/usb/serial/keyspan.c
> @@ -1535,14 +1535,14 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
>
> this_urb = p_priv->outcont_urb;
>
> - dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
> -
> /* Make sure we have an urb then send the message */
> if (this_urb == NULL) {
> dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
> return -1;
> }
>
> + dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
> +
> /* Save reset port val for resend.
> Don't overwrite resend for open/close condition. */
> if ((reset_port + 1) > p_priv->resend_cont)
next prev parent reply other threads:[~2014-05-16 15:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-15 21:55 [PATCH] Fix for possible null pointer dereference in keyspan.c Rickard Strandqvist
2014-05-16 15:30 ` Johan Hovold [this message]
2014-05-16 15:39 ` [PATCH] USB: keyspan: fix potential null pointer dereference Johan Hovold
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=20140516153000.GC8213@localhost \
--to=jhovold@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rickard_strandqvist@spectrumdigital.se \
/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