linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: remove meaningless null check before kfree
@ 2018-08-17  3:42 zhong jiang
  2018-08-17 15:52 ` Robin Holt
  0 siblings, 1 reply; 2+ messages in thread
From: zhong jiang @ 2018-08-17  3:42 UTC (permalink / raw)
  To: cpw, robinmholt; +Cc: arnd, gregkh, linux-kernel

kfree has taken null pointer into account. so check the null pointer
before kfree is meaningless.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/misc/sgi-xp/xpc_partition.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 0c3ef6f..3eba1c4 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -98,8 +98,7 @@
 			len = L1_CACHE_ALIGN(len);
 
 		if (len > buf_len) {
-			if (buf_base != NULL)
-				kfree(buf_base);
+			kfree(buf_base);
 			buf_len = L1_CACHE_ALIGN(len);
 			buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
 							    &buf_base);
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] misc: remove meaningless null check before kfree
  2018-08-17  3:42 [PATCH] misc: remove meaningless null check before kfree zhong jiang
@ 2018-08-17 15:52 ` Robin Holt
  0 siblings, 0 replies; 2+ messages in thread
From: Robin Holt @ 2018-08-17 15:52 UTC (permalink / raw)
  To: zhongjiang; +Cc: Cliff Whickman, Arnd Bergmann, Greg Kroah-Hartman, LKML

On Thu, Aug 16, 2018 at 10:55 PM zhong jiang <zhongjiang@huawei.com> wrote:
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Robin Holt <robinmholt@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-17 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17  3:42 [PATCH] misc: remove meaningless null check before kfree zhong jiang
2018-08-17 15:52 ` Robin Holt

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