lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABdoFFeZW_sj5krvx4s03XSv--0jry+4ER_tT2Yt-08RRsoCkQ@mail.gmail.com>
Date:	Fri, 21 Nov 2014 19:44:17 +0200
From:	Valentina Manea <valentina.manea.m@...il.com>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Shuah Khan <shuah.kh@...sung.com>, linux-usb@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
	Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 1/1] USB-IP: Deletion of unnecessary checks before the
 function call "usb_put_dev"

On Fri, Nov 21, 2014 at 5:36 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 21 Nov 2014 16:33:18 +0100
>
> The usb_put_dev() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/usb/usbip/vhci_hcd.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
> index c02374b..cc1b03e 100644
> --- a/drivers/usb/usbip/vhci_hcd.c
> +++ b/drivers/usb/usbip/vhci_hcd.c
> @@ -518,8 +518,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
>                         dev_info(dev, "SetAddress Request (%d) to port %d\n",
>                                  ctrlreq->wValue, vdev->rhport);
>
> -                       if (vdev->udev)
> -                               usb_put_dev(vdev->udev);
> +                       usb_put_dev(vdev->udev);
>                         vdev->udev = usb_get_dev(urb->dev);
>
>                         spin_lock(&vdev->ud.lock);
> @@ -539,8 +538,7 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
>                                 usbip_dbg_vhci_hc(
>                                         "Not yet?:Get_Descriptor to device 0 (get max pipe size)\n");
>
> -                       if (vdev->udev)
> -                               usb_put_dev(vdev->udev);
> +                       usb_put_dev(vdev->udev);
>                         vdev->udev = usb_get_dev(urb->dev);
>                         goto out;
>
> @@ -831,8 +829,7 @@ static void vhci_device_reset(struct usbip_device *ud)
>         vdev->speed  = 0;
>         vdev->devid  = 0;
>
> -       if (vdev->udev)
> -               usb_put_dev(vdev->udev);
> +       usb_put_dev(vdev->udev);
>         vdev->udev = NULL;
>
>         if (ud->tcp_socket) {
> --
> 2.1.3
>

Acked-by: Valentina Manea <valentina.manea.m@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ