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] [day] [month] [year] [list]
Date:   Thu, 07 Jun 2018 13:16:45 -0700
From:   Joe Perches <joe@...ches.com>
To:     Corentin Labbe <clabbe@...libre.com>, gregkh@...uxfoundation.org,
        stern@...land.harvard.edu
Cc:     linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH] usb: Replace empty define with do while

On Thu, 2018-06-07 at 20:05 +0000, Corentin Labbe wrote:
> It's dangerous to use empty code define.
> Furthermore it lead to the following warning:
> "suggest braces around empty body in an « else » statement"
> 
> So let's replace emptyness by "do {} while(0)"

I also suggest renaming COUNT to something more
intelligible like INCR as the uses are all for
incrementing variables that may not exist.

> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> index c8e9a48e1d51..a60d91eac771 100644
> --- a/drivers/usb/host/ehci.h
> +++ b/drivers/usb/host/ehci.h
> @@ -237,7 +237,7 @@ struct ehci_hcd {			/* one per controller */
>  	struct ehci_stats	stats;
>  #	define COUNT(x) ((x)++)
>  #else
> -#	define COUNT(x)
> +#	define COUNT(x) do {} while (0)
>  #endif
>  
>  	/* debug files */
> diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h
> index 7fcd785c7bc8..dca46d04e288 100644
> --- a/drivers/usb/host/fotg210.h
> +++ b/drivers/usb/host/fotg210.h
> @@ -179,7 +179,7 @@ struct fotg210_hcd {			/* one per controller */
>  	struct fotg210_stats	stats;
>  #	define COUNT(x) ((x)++)
>  #else
> -#	define COUNT(x)
> +#	define COUNT(x) do {} while (0)
>  #endif
>  
>  	/* debug files */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ