提交 7dab5467 编写于 作者: G Gustavo A. R. Silva 提交者: Marcel Holtmann

net: ieee802154: fix potential null pointer dereference

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: NGustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 a611c58b
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册