Re: [PATCH] fore200e: Fix incorrect checks of NULL pointer dereference

From: Markus Elfring
Date: Mon Dec 16 2019 - 03:44:15 EST


> The patch fixes these issues by avoiding NULL pointer dereferences.

I suggest to choose a better wording for this change description.

Will the tag âFixesâ become helpful here?


â
> +++ b/drivers/atm/fore200e.c
â
> @@ -1480,9 +1482,18 @@ fore200e_send(struct atm_vcc *vcc, struct sk_buff *skb)
â
> + fore200e = FORE200E_DEV(vcc->dev);
> + fore200e_vcc = FORE200E_VCC(vcc);
> +
> + if (!fore200e)
> + return -EINVAL;
> +
> + txq = &fore200e->host_txq;
> + if (!fore200e_vcc)
> + return -EINVAL;
>
> if (!test_bit(ATM_VF_READY, &vcc->flags)) {
â


Can the following adjustment be nicer?

+ fore200e_vcc = FORE200E_VCC(vcc);
+ if (!fore200e_vcc)
+ return -EINVAL;
+
+ fore200e = FORE200E_DEV(vcc->dev);
+ if (!fore200e)
+ return -EINVAL;
+
+ txq = &fore200e->host_txq;


Regards,
Markus