Message ID | 20170523181147.GA32714@embeddedgus (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Hi Marcel, Quoting Marcel Holtmann <marcel@holtmann.org>: > Hi Gustavo, > >> Null check at line 918: if (!spi) {, implies spi might be NULL. >> Function spi_get_drvdata() dereference pointer spi. >> Move pointer priv assignment after the null check. >> >> Addresses-Coverity-ID: 1408888 >> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> >> --- >> drivers/net/ieee802154/ca8210.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) > > patch has been applied to bluetooth-next tree. > Awesome :) Thanks -- Gustavo A. R. Silva -- To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c index 25fd3b0..ccaf20d 100644 --- a/drivers/net/ieee802154/ca8210.c +++ b/drivers/net/ieee802154/ca8210.c @@ -912,7 +912,7 @@ static int ca8210_spi_transfer( ) { int i, status = 0; - struct ca8210_priv *priv = spi_get_drvdata(spi); + struct ca8210_priv *priv; struct cas_control *cas_ctl; if (!spi) { @@ -923,6 +923,7 @@ static int ca8210_spi_transfer( return -ENODEV; } + priv = spi_get_drvdata(spi); reinit_completion(&priv->spi_transfer_complete); dev_dbg(&spi->dev, "ca8210_spi_transfer called\n");
Null check at line 918: if (!spi) {, implies spi might be NULL. Function spi_get_drvdata() dereference pointer spi. Move pointer priv assignment after the null check. Addresses-Coverity-ID: 1408888 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> --- drivers/net/ieee802154/ca8210.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)