diff mbox series

wifi: cw1200: Fix potential NULL dereference

Message ID 20241028-cw1200-fix-v1-1-e092b6558d1e@linaro.org (mailing list archive)
State Accepted
Commit 2b94751626a6d49bbe42a19cc1503bd391016bd5
Delegated to: Kalle Valo
Headers show
Series wifi: cw1200: Fix potential NULL dereference | expand

Commit Message

Linus Walleij Oct. 28, 2024, 10:06 p.m. UTC
A recent refactoring was identified by static analysis to
cause a potential NULL dereference, fix this!

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410121505.nyghqEkK-lkp@intel.com/
Fixes: 2719a9e7156c ("wifi: cw1200: Convert to GPIO descriptors")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/net/wireless/st/cw1200/cw1200_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20241028-cw1200-fix-2e61bce86cbd

Best regards,

Comments

Kalle Valo Oct. 31, 2024, 2:20 p.m. UTC | #1
Linus Walleij <linus.walleij@linaro.org> wrote:

> A recent refactoring was identified by static analysis to
> cause a potential NULL dereference, fix this!
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/202410121505.nyghqEkK-lkp@intel.com/
> Fixes: 2719a9e7156c ("wifi: cw1200: Convert to GPIO descriptors")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Patch applied to wireless-next.git, thanks.

2b94751626a6 wifi: cw1200: Fix potential NULL dereference
diff mbox series

Patch

diff --git a/drivers/net/wireless/st/cw1200/cw1200_spi.c b/drivers/net/wireless/st/cw1200/cw1200_spi.c
index 4f346fb977a9..862964a8cc87 100644
--- a/drivers/net/wireless/st/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/st/cw1200/cw1200_spi.c
@@ -450,7 +450,7 @@  static int __maybe_unused cw1200_spi_suspend(struct device *dev)
 {
 	struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));
 
-	if (!cw1200_can_suspend(self->core))
+	if (self && !cw1200_can_suspend(self->core))
 		return -EAGAIN;
 
 	/* XXX notify host that we have to keep CW1200 powered on? */