Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653561

[PATCH] mm: add NULL check to avoid potential NULL pointer dereference

From "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Newsgroups linux.kernel
Subject [PATCH] mm: add NULL check to avoid potential NULL pointer dereference
Date 2017-05-30 23:30 +0200
Message-ID <tMWSe-46V-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


NULL check at line 1226: if (!pgdat), implies that pointer pgdat
might be NULL.
Function rollback_node_hotadd() dereference this pointer.
Add NULL check to avoid a potential NULL pointer dereference.

Addresses-Coverity-ID: 1369133
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 mm/memory_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 599c675..ea3bc3e 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1273,7 +1273,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)
 
 error:
 	/* rollback pgdat allocation and others */
-	if (new_pgdat)
+	if (new_pgdat && pgdat)
 		rollback_node_hotadd(nid, pgdat);
 	memblock_remove(start, size);
 
-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm: add NULL check to avoid potential NULL pointer  dereference "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-05-30 23:30 +0200
  Re: [PATCH] mm: add NULL check to avoid potential NULL pointer  dereference Michal Hocko <mhocko@kernel.org> - 2017-05-31 17:10 +0200

csiph-web