Skip to content

Commit

Permalink
net: ieee802154: fix potential null pointer dereference
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Gustavo A. R. Silva authored and Marcel Holtmann committed May 23, 2017
1 parent a611c58 commit 7dab546
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ieee802154/ca8210.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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");
Expand Down

0 comments on commit 7dab546

Please sign in to comment.