From c1202d7283209339a35fa3f5210b56c20c4a2136 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Thu, 5 May 2022 08:18:47 +0530 Subject: [PATCH] gpu: nvgpu: assert that priv is non-NULL in gk20a_alloc_comptags priv data is available when gk20a_alloc_comptags is called hence add assert for it. CID 274852 Bug 3512546 Change-Id: I9d907153c359900071f0f89b84d2ee15141dd874 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2707492 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Sachin Nikam GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/comptags.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/comptags.c b/drivers/gpu/nvgpu/os/linux/comptags.c index 6f9c172f3..6d248296e 100644 --- a/drivers/gpu/nvgpu/os/linux/comptags.c +++ b/drivers/gpu/nvgpu/os/linux/comptags.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -72,9 +72,10 @@ int gk20a_alloc_comptags(struct gk20a *g, struct nvgpu_os_buffer *buf, lines = 0; } - /* Note that privdata is not validated here as it is available here. */ priv = gk20a_dma_buf_get_drvdata(buf->dmabuf, buf->dev); + nvgpu_assert(priv != NULL); + /* store the allocator so we can use it when we free the ctags */ priv->comptag_allocator = allocator;