From: Dan Carpenter <dan.carpenter@oracle.com>
To: Paul Moore <paul@paul-moore.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Patrick McHardy <kaber@trash.net>,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] cipso: remove an unneeded NULL check in
Date: Tue, 11 Oct 2011 21:55:49 +0000 [thread overview]
Message-ID: <20111011215549.GC30887@longonot.mountain> (raw)
In-Reply-To: <CAHC9VhRMy-DbbkXSSWQPh8QgHAm5xzZ1qWJaYLiOERPagDfrbQ@mail.gmail.com>
On Tue, Oct 11, 2011 at 05:20:11PM -0400, Paul Moore wrote:
> > - if (doi_def = NULL || doi_def->doi = CIPSO_V4_DOI_UNKNOWN)
> > + if (doi_def->doi = CIPSO_V4_DOI_UNKNOWN)
> > goto doi_add_return;
> > for (iter = 0; iter < CIPSO_V4_TAG_MAXCNT; iter++) {
> > switch (doi_def->tags[iter]) {
>
> I'd prefer to keep the NULL check in there as it does afford a little
> bit of extra safety and this is management code after all, not
> per-packet processing code, so the extra check should have no
> observable performance impact.
The dereferences on the lines before mean we would Oops before
reaching the check. But I guess I can move the check forward. The
error handling at goto doi_add_return relies on a non-NULL value for
doi_def but I could just put a return in front of the dereference.
if (!doi_def)
return -EINVAL;
I'll send a patch to do this tomorrow.
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-10-11 21:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-11 13:22 [patch] cipso: remove an unneeded NULL check in cipso_v4_doi_add() Dan Carpenter
2011-10-11 21:20 ` Paul Moore
2011-10-11 21:55 ` Dan Carpenter [this message]
2011-10-11 22:42 ` [patch] cipso: remove an unneeded NULL check in David Miller
2011-10-12 21:28 ` [patch] cipso: remove an unneeded NULL check in cipso_v4_doi_add() Paul Moore
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=20111011215549.GC30887@longonot.mountain \
--to=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=yoshfuji@linux-ipv6.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox