[PATCH] mm: memcomtrol: add warning in case of rtpn = NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kzalloc_node may return NULL. So rtpn should be
checked before dereference in mem_cgroup_init.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 95a045f63d98 ("mm: memcontrol: consolidate memory controller initialization")
Signed-off-by: Anastasia Belova <abelova@xxxxxxxxxxxxx>
---
 mm/memcontrol.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e8ca4bdcb03c..7998dbf3c7cd 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -7377,6 +7377,7 @@ static int __init mem_cgroup_init(void)
 		struct mem_cgroup_tree_per_node *rtpn;
 
 		rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, node);
+		WARN_ON(!rtpn);
 
 		rtpn->rb_root = RB_ROOT;
 		rtpn->rb_rightmost = NULL;
-- 
2.30.2





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux