linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer
@ 2021-04-15  8:47 Colin King
  2021-04-15  9:04 ` Marc Kleine-Budde
  0 siblings, 1 reply; 4+ messages in thread
From: Colin King @ 2021-04-15  8:47 UTC (permalink / raw)
  To: Wolfgang Grandegger, Marc Kleine-Budde, David S . Miller,
	Jakub Kicinski, Vincent Mailhol, Arunachalam Santhanam,
	linux-can, netdev
  Cc: kernel-janitors, linux-kernel

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer
  2021-04-15  8:47 [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer Colin King
@ 2021-04-15  9:04 ` Marc Kleine-Budde
  2021-04-15 11:42   ` Vincent MAILHOL
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-04-15  9:04 UTC (permalink / raw)
  To: Colin King
  Cc: Wolfgang Grandegger, David S . Miller, Jakub Kicinski,
	Vincent Mailhol, Arunachalam Santhanam, linux-can, netdev,
	kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

On 15.04.2021 09:47:23, Colin King wrote:
> 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>

Looks good. Applied to linux-can-next/testing.

Tnx,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer
  2021-04-15  9:04 ` Marc Kleine-Budde
@ 2021-04-15 11:42   ` Vincent MAILHOL
  2021-04-15 11:47     ` Marc Kleine-Budde
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent MAILHOL @ 2021-04-15 11:42 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Colin King, Wolfgang Grandegger, David S . Miller,
	Jakub Kicinski, Arunachalam Santhanam, linux-can, netdev,
	kernel-janitors, open list

On Thu. 15 Apr 2021 at 18:04, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> On 15.04.2021 09:47:23, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > There is an assignment to *netdev that is can potentially be null but the
                                           ^^
Typo: that is can -> that can

> > 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>

Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

Thanks Colin!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer
  2021-04-15 11:42   ` Vincent MAILHOL
@ 2021-04-15 11:47     ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-04-15 11:47 UTC (permalink / raw)
  To: Vincent MAILHOL
  Cc: Colin King, Wolfgang Grandegger, David S . Miller,
	Jakub Kicinski, Arunachalam Santhanam, linux-can, netdev,
	kernel-janitors, open list

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

On 15.04.2021 20:42:36, Vincent MAILHOL wrote:
> On Thu. 15 Apr 2021 at 18:04, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> > On 15.04.2021 09:47:23, Colin King wrote:
> > > From: Colin Ian King <colin.king@canonical.com>
> > >
> > > There is an assignment to *netdev that is can potentially be null but the
>                                            ^^
> Typo: that is can -> that can

Fixed.

> > > 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>
> 
> Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>

Added to the patch.

Tnx,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-15 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15  8:47 [PATCH][next] can: etas_es58x: Fix missing null check on netdev pointer Colin King
2021-04-15  9:04 ` Marc Kleine-Budde
2021-04-15 11:42   ` Vincent MAILHOL
2021-04-15 11:47     ` Marc Kleine-Budde

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).