Skip to contentSkip to conversation

spi: spidev: Don't mangle max_speed_hz in underlying spi device

DISCUSSION Dan Carpenter 1 participant 1 message Nov 11, 2014 SPI

lore
Share & tools
lore
#0 lore raw

Hello Mark Brown,

This is a semi-automatic email about new static checker warnings.

The patch c4f5669ff40e: "spi: spidev: Don't mangle max_speed_hz i underlying spi device" from Nov 8, 2014, leads to the following Smatch complaint:

drivers/spi/spidev.c:581 spidev_release()

	 warn: variable dereferenced before check 'spidev->spi' (see line 577)

drivers/spi/spidev.c
576

   577			spidev->speed_hz = spidev->spi->max_speed_hz;
                                           ^^^^^^^^^^^^^

New unchecked dereference.

578
579 /* ... after we unbound from the underlying device? */
580 spin_lock_irq(&spidev->spi_lock);

   581			dofree = (spidev->spi == NULL);
                                  ^^^^^^^^^^^^^^^^^^^

Old code assumes ->spi can be NULL.

   582			spin_unlock_irq(&spidev->spi_lock);
   583

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html