LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
	devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	John Whitmore <johnfwhitmore@gmail.com>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Richard Smith <richardsmith@google.com>
Subject: Re: [PATCH] staging: rtl8192u: Remove an unnecessary NULL check
Date: Wed, 22 May 2019 12:24:12 +0300	[thread overview]
Message-ID: <20190522092412.GR31203@kadam> (raw)
In-Reply-To: <CAKwvOdmpHOMwVM+d_W3eeu3xC+nZqBTO_hx9Wf1z10yivxSe7A@mail.gmail.com>

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


  reply	other threads:[~2019-05-22  9:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 17:42 Nathan Chancellor
2019-05-21 22:53 ` Nick Desaulniers
2019-05-21 22:57   ` Nick Desaulniers
2019-05-22  9:24     ` Dan Carpenter [this message]
2019-05-22  7:04 ` Dan Carpenter
2019-05-22 20:39   ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522092412.GR31203@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johnfwhitmore@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=richardsmith@google.com \
    --subject='Re: [PATCH] staging: rtl8192u: Remove an unnecessary NULL check' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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