linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] media: venus: hfi: fix return value check in sys_get_prop_image_version()
@ 2021-07-07  7:45 Zhen Lei
  2021-07-07 22:48 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Lei @ 2021-07-07  7:45 UTC (permalink / raw)
  To: Stanimir Varbanov, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel
  Cc: Zhen Lei, Stephen Boyd, Dikshita Agarwal

In case of error, the function qcom_smem_get() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Fixes: d566e78dd6af ("media: venus : hfi: add venus image info into smem")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/media/platform/qcom/venus/hfi_msgs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c
index d9fde66f6fa8..9a2bdb002edc 100644
--- a/drivers/media/platform/qcom/venus/hfi_msgs.c
+++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
@@ -261,7 +261,7 @@ sys_get_prop_image_version(struct device *dev,
 
 	smem_tbl_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
 		SMEM_IMG_VER_TBL, &smem_blk_sz);
-	if (smem_tbl_ptr && smem_blk_sz >= SMEM_IMG_OFFSET_VENUS + VER_STR_SZ)
+	if (!IS_ERR(smem_tbl_ptr) && smem_blk_sz >= SMEM_IMG_OFFSET_VENUS + VER_STR_SZ)
 		memcpy(smem_tbl_ptr + SMEM_IMG_OFFSET_VENUS,
 		       img_ver, VER_STR_SZ);
 }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] media: venus: hfi: fix return value check in sys_get_prop_image_version()
  2021-07-07  7:45 [PATCH 1/1] media: venus: hfi: fix return value check in sys_get_prop_image_version() Zhen Lei
@ 2021-07-07 22:48 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2021-07-07 22:48 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab,
	Stanimir Varbanov, Zhen Lei, linux-arm-msm, linux-kernel,
	linux-media
  Cc: Dikshita Agarwal

Quoting Zhen Lei (2021-07-07 00:45:17)
> In case of error, the function qcom_smem_get() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
>
> Fixes: d566e78dd6af ("media: venus : hfi: add venus image info into smem")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-07 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07  7:45 [PATCH 1/1] media: venus: hfi: fix return value check in sys_get_prop_image_version() Zhen Lei
2021-07-07 22:48 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).