Re: [PATCH v4] bitops: Fix shift overflow in GENMASK macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Maxime,

On Fri, Nov 14, 2014 at 5:07 PM, Maxime Coquelin <maxime.coquelin@xxxxxx> wrote:
> Looking at all GENMASK and GENMASK_ULL occurences in v3.18-rc4,
> I (only) found one possible candidate in drivers/spi/spi_xtensa-xtfpga.c:
>
> static u32 xtfpga_spi_txrx_word(struct spi_device *spi, unsigned nsecs,
>                 u32 v, u8 bits)
> {
>     struct xtfpga_spi *xspi = spi_master_get_devdata(spi->master);
>
>     xspi->data = (xspi->data << bits) | (v & GENMASK(bits - 1, 0));
> ...
> }
>
> Max F., can xtfpga_spi_txrx_word() be called with "bits" = 32?

No, bits should never be greater than 16, because spi_master sets its
bits_per_word_mask to SPI_BPW_RANGE_MASK(1, 16).

-- 
Thanks.
-- Max
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]