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] [day] [month] [year] [list]
Message-ID: <1419204617.4200.13.camel@perches.com>
Date:	Sun, 21 Dec 2014 15:30:17 -0800
From:	Joe Perches <joe@...ches.com>
To:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc:	Oleg Drokin <oleg.drokin@...el.com>,
	Andreas Dilger <andreas.dilger@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Lai Siyao <laisiyao@...mcloud.com>,
	Peng Tao <bergwolf@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Greg Donald <gdonald@...il.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	"John L. Hammond" <john.hammond@...el.com>,
	Brian Behlendorf <behlendorf1@...l.gov>,
	HPDD-discuss@...ts.01.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: lustre: lustre: llite: llite_lib.c:  Removes
 unnecessary NULL check

On Sun, 2014-12-21 at 23:08 +0100, Rickard Strandqvist wrote:
> Removes same unnecessary NULL check.

Depending on settings, these checks are necessary:

drivers/staging/lustre/lustre/include/obd_support.h:#define POISON(ptr, c, s) memset(ptr, c, s)
[]
drivers/staging/lustre/lustre/include/obd_support.h:#define OBD_FREE_PRE(ptr, size, name)                                  \
drivers/staging/lustre/lustre/include/obd_support.h-    LASSERT(ptr);                                              \
drivers/staging/lustre/lustre/include/obd_support.h-    obd_memory_sub(size);                                      \
drivers/staging/lustre/lustre/include/obd_support.h-    CDEBUG(D_MALLOC, name " '" #ptr "': %d at %p.\n",              \
drivers/staging/lustre/lustre/include/obd_support.h-           (int)(size), ptr);                                      \
drivers/staging/lustre/lustre/include/obd_support.h-    POISON(ptr, 0x5a, size)
[]
drivers/staging/lustre/lustre/include/obd_support.h:#define OBD_FREE(ptr, size)                                            \
drivers/staging/lustre/lustre/include/obd_support.h-do {                                                                          \
drivers/staging/lustre/lustre/include/obd_support.h-    OBD_FREE_PRE(ptr, size, "kfreed");                                  \
drivers/staging/lustre/lustre/include/obd_support.h-    kfree(ptr);                                                     \
drivers/staging/lustre/lustre/include/obd_support.h-    POISON_PTR(ptr);                                                      \
drivers/staging/lustre/lustre/include/obd_support.h-} while (0)

> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
[]
> @@ -591,10 +591,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
>  		get_uuid2fsid(uuid->uuid, strlen(uuid->uuid), &sbi->ll_fsid);
>  	}
>  
> -	if (data != NULL)
> -		OBD_FREE_PTR(data);
> -	if (osfs != NULL)
> -		OBD_FREE_PTR(osfs);
> +	OBD_FREE_PTR(data);
> +	OBD_FREE_PTR(osfs);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ