All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jussi Kivilinna <jussi.kivilinna@haltian.com>,
	Colin Ian King <colin.king@canonical.com>,
	Tim Harvey <tharvey@gateworks.com>,
	Raz Manor <Raz.Manor@valens.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Peter Senna Tschudin <peter.senna@gmail.com>
Subject: Re: [PATCH v2] usb: gadget: udc: add null check before pointer dereference
Date: Tue, 2 May 2017 14:45:35 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1705021445220.1568-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20170502163722.GA27331@embeddedgus>

On Tue, 2 May 2017, Gustavo A. R. Silva wrote:

> Add null check before dereferencing dev->regs pointer inside
> net2280_led_shutdown() function.
> 
> Addresses-Coverity-ID: 101783
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> Changes in v2:
>   Move the net2280_led_shutdown() call later.
> 
>  drivers/usb/gadget/udc/net2280.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
> index 3828c2e..4f5c0c4 100644
> --- a/drivers/usb/gadget/udc/net2280.c
> +++ b/drivers/usb/gadget/udc/net2280.c
> @@ -3573,7 +3573,6 @@ static void net2280_remove(struct pci_dev *pdev)
>  	BUG_ON(dev->driver);
>  
>  	/* then clean up the resources we allocated during probe() */
> -	net2280_led_shutdown(dev);
>  	if (dev->requests) {
>  		int		i;
>  		for (i = 1; i < 5; i++) {
> @@ -3588,8 +3587,10 @@ static void net2280_remove(struct pci_dev *pdev)
>  		free_irq(pdev->irq, dev);
>  	if (dev->quirks & PLX_PCIE)
>  		pci_disable_msi(pdev);
> -	if (dev->regs)
> +	if (dev->regs) {
> +		net2280_led_shutdown(dev);
>  		iounmap(dev->regs);
> +	}
>  	if (dev->region)
>  		release_mem_region(pci_resource_start(pdev, 0),
>  				pci_resource_len(pdev, 0));

Acked-by: Alan Stern <stern@rowland.harvard.edu>

      reply	other threads:[~2017-05-02 18:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02  3:38 [PATCH] usb: gadget: udc: add null check before pointer dereference Gustavo A. R. Silva
2017-05-02 14:31 ` Alan Stern
2017-05-02 15:29   ` Gustavo A. R. Silva
2017-05-02 16:37     ` [PATCH v2] " Gustavo A. R. Silva
2017-05-02 18:45       ` Alan Stern [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=Pine.LNX.4.44L0.1705021445220.1568-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=Raz.Manor@valens.com \
    --cc=balbi@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=garsilva@embeddedor.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jussi.kivilinna@haltian.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    --cc=tharvey@gateworks.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.