RE: [PATCH] spi-altera: Fix NULL pointer dereference in spi_bitbang_transfer_one

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

 



> From: Mark Brown [mailto:broonie@xxxxxxxxxx]
> Sent: 03 December 2014 13:03
> 
> If we can safely handle not having the callback then we should fix the
> call site to safely handle a null pointer rather than adding dummy
> callbacks.  That way this is fixed once for all drivers that need it.

Is it better to test for a null pointer at the spi-bitbang call-site, or get spi-bitbang to add a dummy callback of its own in spi_bitbang_start? The former has the overhead of a test every call, even for those drivers that provide the callback, while the latter has the overhead of a dummy call only for those drivers that don't.

At present, spi_bitbang_start assumes that if bitbang->txrx_bufs is defined, then bitbang->setup_transfer is also defined without checking it.

> I'd expect to see some code that checks to see if the caller is trying
> to change paramters.

If you mean in the spi-altera code: The spi-altera driver does not know what the hardware fixed parameters are, so it can't make a decision about whether the caller is trying to change them to something else.

If you mean in the spi-bitbang code: The code appears to do this with the do_setup test, but it will always do a setup for the very first transfer in a message regardless, invoking the missing callback.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" 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]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux