From: Colin King <colin.king@canonical.com>
To: Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>,
linux-can@vger.kernel.org, netdev@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer
Date: Thu, 15 Apr 2021 09:47:23 +0100 [thread overview]
Message-ID: <20210415084723.1807935-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
There is an assignment to *netdev that is can potentially be null but the
null check is checking netdev and not *netdev as intended. Fix this by
adding in the missing * operator.
Addresses-Coverity: ("Dereference before null check")
Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h
index 5f4e7dc5be35..fcf219e727bf 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.h
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.h
@@ -625,7 +625,7 @@ static inline int es58x_get_netdev(struct es58x_device *es58x_dev,
return -ECHRNG;
*netdev = es58x_dev->netdev[channel_idx];
- if (!netdev || !netif_device_present(*netdev))
+ if (!*netdev || !netif_device_present(*netdev))
return -ENODEV;
return 0;
--
2.30.2
next reply other threads:[~2021-04-15 8:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-15 8:47 Colin King [this message]
2021-04-15 9:04 ` [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer Marc Kleine-Budde
2021-04-15 11:42 ` Vincent MAILHOL
2021-04-15 11:47 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210415084723.1807935-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=arunachalam.santhanam@in.bosch.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).