lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1497284875-19999-12-git-send-email-stanimir.varbanov@linaro.org>
Date:   Mon, 12 Jun 2017 19:27:48 +0300
From:   Stanimir Varbanov <stanimir.varbanov@...aro.org>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Hans Verkuil <hverkuil@...all.nl>
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-msm@...r.kernel.org,
        Stanimir Varbanov <stanimir.varbanov@...aro.org>
Subject: [PATCH v10 11/18] media: venus: hfi_cmds: fix variable dereferenced before check

This fixes a warning found when building the driver with gcc7:

drivers/media/platform/qcom/venus/hfi_cmds.c:415
pkt_session_set_property_1x() warn: variable dereferenced before
check 'pkt' (see line 412)
drivers/media/platform/qcom/venus/hfi_cmds.c:1177
pkt_session_set_property_3xx() warn: variable dereferenced before
check 'pkt' (see line 1174)

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@...aro.org>
---
 drivers/media/platform/qcom/venus/hfi_cmds.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index dad41a6af42e..b83c5b8ddccb 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -409,12 +409,14 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *pkt,
 static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt,
 				       void *cookie, u32 ptype, void *pdata)
 {
-	void *prop_data = &pkt->data[1];
+	void *prop_data;
 	int ret = 0;
 
 	if (!pkt || !cookie || !pdata)
 		return -EINVAL;
 
+	prop_data = &pkt->data[1];
+
 	pkt->shdr.hdr.size = sizeof(*pkt);
 	pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
 	pkt->shdr.session_id = hash32_ptr(cookie);
@@ -1171,12 +1173,14 @@ static int
 pkt_session_set_property_3xx(struct hfi_session_set_property_pkt *pkt,
 			     void *cookie, u32 ptype, void *pdata)
 {
-	void *prop_data = &pkt->data[1];
+	void *prop_data;
 	int ret = 0;
 
 	if (!pkt || !cookie || !pdata)
 		return -EINVAL;
 
+	prop_data = &pkt->data[1];
+
 	pkt->shdr.hdr.size = sizeof(*pkt);
 	pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
 	pkt->shdr.session_id = hash32_ptr(cookie);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ