[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1303264924.3464.69.camel@localhost>
Date: Wed, 20 Apr 2011 03:02:04 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Dmitry Torokhov <dtor@...are.com>
Cc: linux-kernel@...r.kernel.org, stable@...nel.org,
Sarah Sharp <sarah.a.sharp@...ux.intel.com>,
akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
stable-review@...nel.org, alan@...rguk.ukuu.org.uk,
Greg KH <gregkh@...e.de>
Subject: Re: [Stable-review] [24/28] USB: xhci - fix unsafe macro
definitions
On Tue, 2011-04-19 at 13:31 -0700, Greg KH wrote:
> 2.6.32-longterm review patch. If anyone has any objections, please let us know.
>
> ------------------
>
> From: Dmitry Torokhov <dtor@...are.com>
>
> commit 5a6c2f3ff039154872ce597952f8b8900ea0d732 upstream.
>
> Macro arguments used in expressions need to be enclosed in parenthesis
> to avoid unpleasant surprises.
Do you know of any specific uses of these macros where the missing
parentheses caused 'unpleasant surprises'?
Ben.
> This should be queued for kernels back to 2.6.31
>
> Signed-off-by: Dmitry Torokhov <dtor@...are.com>
> Signed-off-by: Sarah Sharp <sarah.a.sharp@...ux.intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
>
> ---
> drivers/usb/host/xhci.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -232,7 +232,7 @@ struct xhci_op_regs {
> * notification type that matches a bit set in this bit field.
> */
> #define DEV_NOTE_MASK (0xffff)
> -#define ENABLE_DEV_NOTE(x) (1 << x)
> +#define ENABLE_DEV_NOTE(x) (1 << (x))
> /* Most of the device notification types should only be used for debug.
> * SW does need to pay attention to function wake notifications.
> */
> @@ -579,11 +579,11 @@ struct xhci_ep_ctx {
> #define EP_STATE_STOPPED 3
> #define EP_STATE_ERROR 4
> /* Mult - Max number of burtst within an interval, in EP companion desc. */
> -#define EP_MULT(p) ((p & 0x3) << 8)
> +#define EP_MULT(p) (((p) & 0x3) << 8)
> /* bits 10:14 are Max Primary Streams */
> /* bit 15 is Linear Stream Array */
> /* Interval - period between requests to an endpoint - 125u increments. */
> -#define EP_INTERVAL(p) ((p & 0xff) << 16)
> +#define EP_INTERVAL(p) (((p) & 0xff) << 16)
> #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
>
> /* ep_info2 bitmasks */
>
>
> _______________________________________________
> Stable-review mailing list
> Stable-review@...ux.kernel.org
> http://linux.kernel.org/mailman/listinfo/stable-review
>
--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists