gpu: nvgpu: add checks for kzalloc() allocations

Check kzalloc() allocations for failures and return
an error if an allocation fails.

Bug 2279948

Change-Id: I8a2c3b84904da897ad6118900c11489c8656c20f
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2020123
(cherry picked from commit fadd0014da)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2298066
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Nitin Kumbhar
2019-02-15 15:16:17 +05:30
committed by mobile promotions
parent ea14973b14
commit aaecfae53f
3 changed files with 8 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -628,6 +628,8 @@ static int clk_prog_construct_1x_master(struct gk20a *g,
pclkprog->p_vf_entries = (struct ctrl_clk_clk_prog_1x_master_vf_entry *)
nvgpu_kzalloc(g, vfsize);
if (!pclkprog->p_vf_entries)
return -ENOMEM;
memcpy(pclkprog->p_vf_entries, ptmpprog->p_vf_entries, vfsize);