drivers/net/ieee802154/ca8210.c:918:9-12: ERROR: spi is NULL but dereferenced. (fwd)
From: Julia Lawall
Date: Wed May 24 2017 - 03:38:42 EST
dev_crit should dereference its first argument, so &spi->dev is not valid
in this place if spi is NULL.
julia
---------- Forwarded message ----------
Date: Wed, 24 May 2017 05:55:09 +0800
From: kbuild test robot <fengguang.wu@xxxxxxxxx>
To: kbuild@xxxxxx
Cc: Julia Lawall <julia.lawall@xxxxxxx>
Subject: drivers/net/ieee802154/ca8210.c:918:9-12: ERROR: spi is NULL but
dereferenced.
CC: kbuild-all@xxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
TO: Harry Morris <harrymorris12@xxxxxxxxx>
CC: Marcel Holtmann <marcel@xxxxxxxxxxxx>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 56fff1bb0f31358bf81a3c64a8dcd6da0dc44263
commit: ded845a781a578dfb0b5b2c138e5a067aa3b1242 ieee802154: Add CA8210 IEEE 802.15.4 device driver
date: 6 weeks ago
:::::: branch date: 5 hours ago
:::::: commit date: 6 weeks ago
>> drivers/net/ieee802154/ca8210.c:918:9-12: ERROR: spi is NULL but dereferenced.
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout ded845a781a578dfb0b5b2c138e5a067aa3b1242
vim +918 drivers/net/ieee802154/ca8210.c
ded845a78 Harry Morris 2017-03-28 902 * @len: length of the buffer being sent
ded845a78 Harry Morris 2017-03-28 903 *
ded845a78 Harry Morris 2017-03-28 904 * Return: 0 or linux error code
ded845a78 Harry Morris 2017-03-28 905 */
ded845a78 Harry Morris 2017-03-28 906 static int ca8210_spi_transfer(
ded845a78 Harry Morris 2017-03-28 907 struct spi_device *spi,
ded845a78 Harry Morris 2017-03-28 908 const u8 *buf,
ded845a78 Harry Morris 2017-03-28 909 size_t len
ded845a78 Harry Morris 2017-03-28 910 )
ded845a78 Harry Morris 2017-03-28 911 {
ded845a78 Harry Morris 2017-03-28 912 int i, status = 0;
ded845a78 Harry Morris 2017-03-28 913 struct ca8210_priv *priv = spi_get_drvdata(spi);
ded845a78 Harry Morris 2017-03-28 914 struct cas_control *cas_ctl;
ded845a78 Harry Morris 2017-03-28 915
ded845a78 Harry Morris 2017-03-28 916 if (!spi) {
ded845a78 Harry Morris 2017-03-28 917 dev_crit(
ded845a78 Harry Morris 2017-03-28 @918 &spi->dev,
ded845a78 Harry Morris 2017-03-28 919 "NULL spi device passed to ca8210_spi_transfer\n"
ded845a78 Harry Morris 2017-03-28 920 );
ded845a78 Harry Morris 2017-03-28 921 return -ENODEV;
ded845a78 Harry Morris 2017-03-28 922 }
ded845a78 Harry Morris 2017-03-28 923
ded845a78 Harry Morris 2017-03-28 924 reinit_completion(&priv->spi_transfer_complete);
ded845a78 Harry Morris 2017-03-28 925
ded845a78 Harry Morris 2017-03-28 926 dev_dbg(&spi->dev, "ca8210_spi_transfer called\n");
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation