Re: [PATCH] staging: rtl8192u: Remove an unnecessary NULL check
From: Dan Carpenter
Date: Wed May 22 2019 - 05:27:12 EST
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