From patchwork Thu Jun 15 16:31:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 105675 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp889697qgd; Thu, 15 Jun 2017 09:36:32 -0700 (PDT) X-Received: by 10.84.218.136 with SMTP id r8mr7187071pli.265.1497544592752; Thu, 15 Jun 2017 09:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497544592; cv=none; d=google.com; s=arc-20160816; b=Yn8FE8/HQl1O7HULGPO/8FC0xr0FoX07DAD8MwJ9p/3QNNMhX5e290v7MdeeR6w8CT vNkh/i4Tv04QmwVettpKXCKDRf7MFJLX2ZNrTfwJSl8j0ObKjgN+RfBvqAyr2YctjvmK pO34bZEulwI72DI84xWT6Q3OGaI//WvzyiRx3/pheqlOiSC+MsoBq6tDi/C+GV0z5tKW eyJKAM5Ge2TObfb+Qt98MSNTMwE2zREDyda/L7SDoiVBShBnbcoiDJ39bFQhuRvXopf4 VMHbaBLZlyrC4vzx0I7wayVU22wxgNN4VYNZOCiYHrXCb4NHGAFrudUoHYJuzzNSP0t8 /7/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ASoBwd003NiCzBgJB/F4UIs6ueyEsoVuqMIB4UWs3OY=; b=P1rTpUgsIXBfl+S4glFSVnM81aBW1AMYIgUWpz3teHxQ4araxL2EGQLqVV2hci+RPf wL7OGrOvrY0RzzFNv67x3DeHa8ObH0XL5iY+A9yHl7NQMiI7yMfXwIUbPBcKdu5Amc4t sWo+oRirEBGcU6tLbtDP6q8gl6Kkc7DSj+tZGQt28WcbaG1F9aiqmjJda89ja+/VcyWc CHeNw5zzLJ6cJYz8rCp91/Cd/Q1+ivV+HRlQkS2aIkELIUOLNgIBfs8gf3pfuhaViHGy J2VNbzzx14OstapnM/S4SyK8UbNMjqZBekZI1HsBFTyXEOpobcSJguxKV/qy+sZsmU1O ngug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=PUG8rTle; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34si374211plc.583.2017.06.15.09.36.32; Thu, 15 Jun 2017 09:36:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=PUG8rTle; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbdFOQdZ (ORCPT + 10 others); Thu, 15 Jun 2017 12:33:25 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:35894 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752545AbdFOQdP (ORCPT ); Thu, 15 Jun 2017 12:33:15 -0400 Received: by mail-wr0-f177.google.com with SMTP id 36so25248063wry.3 for ; Thu, 15 Jun 2017 09:33:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PTyoPZBrq6iZva4zHnyG6otP9L/TlXnfZ3rg7uBAhNU=; b=PUG8rTleYiRzdBG/zdN8ggQpRVuY2AV/B6Sq/v6INpqobwzlWe7eo7ToVF2/1SuZSY 6IOmYz9mMjxDSmJc+lzb+Ns6BgfI7SNKIn5w80SD2GaGWynVYgP0v6alhOTJfxLGgXQy 04he9GYWBuKRF1Dko+tnhzfzWeOAgT/uc6z8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PTyoPZBrq6iZva4zHnyG6otP9L/TlXnfZ3rg7uBAhNU=; b=shQChR/ge2VuL7Gq7jmeTE24SiZMP+wHdqfHoKRJx+oJsIgPRC1yy90X5LACGnY1Jq WULyfOmBifjbvGJXHWeu2idxVf4tfvj+e/v4GN04yxdxfw3Uy8HrmCKuOQC4ULPSQSph HJEElTyJooj/A1Pjd9ev1h3wQ5jzIPu2zXCpSWSE1HKmaR0zDeUMNK8NhhiikrF/gWg/ OiFBQE6f24Ri1Oc2htJUmBMDPhvFhAlbUx6G9DZuQeXNeYPndTnjRb82VEluWXOXF0+j BH/q9hT9PgdXaAO7idYkRnBAuYPtFGIKmyPVG21pEiMDrfRLom6fDLIH/4/qf7XOPJCG jVXg== X-Gm-Message-State: AKS2vOyv3m5xGbFLVFA7mJEx2avVyQVVvhnS/8X6U216Gw3HOwZ6UqW/ q5rgqkwCHM7k+gCphBfUpQ== X-Received: by 10.223.182.172 with SMTP id j44mr3062810wre.122.1497544388635; Thu, 15 Jun 2017 09:33:08 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id m73sm541890wmi.25.2017.06.15.09.33.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Jun 2017 09:33:08 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov Subject: [PATCH v11 11/19] media: venus: hfi_cmds: fix variable dereferenced before check Date: Thu, 15 Jun 2017 19:31:52 +0300 Message-Id: <1497544320-2269-12-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497544320-2269-1-git-send-email-stanimir.varbanov@linaro.org> References: <1497544320-2269-1-git-send-email-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/media/platform/qcom/venus/hfi_cmds.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);