lkml.org 
[lkml]   [2019]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] x86: uv: Fix potential NULL pointer dereference of kmalloc_node
From
Date
On Sat, 2019-03-02 at 15:09 -0600, Aditya Pakki wrote:
> kmalloc_node might fail to allocate memory for thp field. This fix
> attempts to avoid a potential NULL pointer dereference.

right

> diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
[]
> @@ -2011,6 +2011,9 @@ static void make_per_cpu_thp(struct bau_control *smaster)
> size_t hpsz = sizeof(struct hub_and_pnode) * num_possible_cpus();
>
> smaster->thp = kmalloc_node(hpsz, GFP_KERNEL, smaster->osnode);
> + if (!smaster->thp)
> + return;
> +
> memset(smaster->thp, 0, hpsz);

Could use kzalloc_node as well


\
 
 \ /
  Last update: 2019-03-02 22:13    [W:1.291 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site