lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 11 Oct 2011 17:20:11 -0400
From:	Paul Moore <paul@...l-moore.com>
To:	Dan Carpenter <dan.carpenter@...cle.com>, netdev@...r.kernel.org
Cc:	"David S. Miller" <davem@...emloft.net>,
	Alexey Kuznetsov <kuznet@....inr.ac.ru>,
	James Morris <jmorris@...ei.org>,
	Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
	Patrick McHardy <kaber@...sh.net>,
	kernel-janitors@...r.kernel.org
Subject: Re: [patch] cipso: remove an unneeded NULL check in cipso_v4_doi_add()

On Tue, Oct 11, 2011 at 9:22 AM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> We dereference doi_def on the line before the NULL check.  It has
> been this way since 2008.  I checked all the callers and doi_def is
> always non-NULL here.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
>
> diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
> index 2c2a98e..86f3b88 100644
> --- a/net/ipv4/cipso_ipv4.c
> +++ b/net/ipv4/cipso_ipv4.c
> @@ -476,7 +476,7 @@ int cipso_v4_doi_add(struct cipso_v4_doi *doi_def,
>        doi = doi_def->doi;
>        doi_type = doi_def->type;
>
> -       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.

-- 
paul moore
www.paul-moore.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ