Skip to content

Commit

Permalink
can: etas_es58x: Fix missing null check on netdev pointer
Browse files Browse the repository at this point in the history
There is an assignment to *netdev that is that can potentially be null
but the null check is checking netdev and not *netdev as intended. Fix
this by adding in the missing * operator.

Fixes: 8537257 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
Link: https://lore.kernel.org/r/20210415084723.1807935-1-colin.king@canonical.com
Addresses-Coverity: ("Dereference before null check")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Colin Ian King authored and Marc Kleine-Budde committed Apr 24, 2021
1 parent b2f0ca0 commit 2ce4fd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/can/usb/etas_es58x/es58x_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2ce4fd5

Please sign in to comment.