summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2018-03-28 07:12:11 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-04-10 08:42:56 -0400
commitd693952a0b52127f23093c28a2896a3fd395485b (patch)
tree2f7a00bfc31ab05bcee370913e3407fbf1732dac
parent31432919cac8fc4ddad3b9245cf61ffd47d5db82 (diff)
gpu: nvgpu: check null before accessing nvgpu_firmware.
check for null value of nvgpu_firmware before accessing them in nvgpu_firmware_release(). Coverity defect id: 2983427, 2983428 Bug 200291879 Change-Id: I946cb448351441ee820aa3e5d8db649943d20d16 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1683505 Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/firmware.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/firmware.c b/drivers/gpu/nvgpu/common/linux/firmware.c
index a76165ff..9a4dc653 100644
--- a/drivers/gpu/nvgpu/common/linux/firmware.c
+++ b/drivers/gpu/nvgpu/common/linux/firmware.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -109,6 +109,9 @@ err:
109 109
110void nvgpu_release_firmware(struct gk20a *g, struct nvgpu_firmware *fw) 110void nvgpu_release_firmware(struct gk20a *g, struct nvgpu_firmware *fw)
111{ 111{
112 if(!fw)
113 return;
114
112 nvgpu_kfree(g, fw->data); 115 nvgpu_kfree(g, fw->data);
113 nvgpu_kfree(g, fw); 116 nvgpu_kfree(g, fw);
114} 117}