lkml.org 
[lkml]   [2019]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] fore200e: Fix incorrect checks of NULL pointer dereference
From
Date
> 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

\
 
 \ /
  Last update: 2019-12-16 09:44    [W:0.059 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site