[PATCH] staging: rtl8192u: Remove an unnecessary NULL check

Dan Carpenter dan.carpenter at oracle.com
Wed May 22 09:24:12 UTC 2019


On Tue, May 21, 2019 at 03:57:46PM -0700, Nick Desaulniers wrote:
> > > -       if (param->u.wpa_ie.len > MAX_WPA_IE_LEN ||
> > > -           (param->u.wpa_ie.len && !param->u.wpa_ie.data))
> >
> > Right so, the types in this expression:
> >
> > param: struct ieee_param*
> > param->u: *anonymous union*
> > param->u.wpa_ie: *anonymous struct*
> > param->u.wpa_ie.len: u32
> > param->u.wpa_ie.data: u8 [0]
> > as defined in drivers/staging/rtl8192u/ieee80211/ieee80211.h#L295
> > https://github.com/ClangBuiltLinux/linux/blob/9c7db5004280767566e91a33445bf93aa479ef02/drivers/staging/rtl8192u/ieee80211/ieee80211.h#L295-L322
> >
> > so this is a tricky case, because in general array members can never
> > themselves be NULL,


Unless they array was the first struct member, obviously.


> >  and usually I trust -Wpointer-bool-conversion, but
> > this is a special case because of the flexible array member:

Nah.  It's the same thing.  That patch is fine.

regards,
dan carpenter



More information about the devel mailing list