Re: [PATCH 1/3] spi: fix undefined behaviour in SPI_BPW_RANGE_MASK

2013-06-01 Thread Mark Brown
On Thu, May 30, 2013 at 09:59:39AM -0600, Stephen Warren wrote: > From: Stephen Warren > > The parameters to SPI_BPW_RANGE_MASK() are in the range 1..32. If 32 is > used as a parameter, part of the expression is "1 << 32". Since 32 is >= > the size of the type in use, such a shift is undefined be

[PATCH 1/3] spi: fix undefined behaviour in SPI_BPW_RANGE_MASK

2013-05-30 Thread Stephen Warren
From: Stephen Warren The parameters to SPI_BPW_RANGE_MASK() are in the range 1..32. If 32 is used as a parameter, part of the expression is "1 << 32". Since 32 is >= the size of the type in use, such a shift is undefined behaviour. Add macro SPI_BIT_MASK to Implement a special case and thus avoid