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: 9789195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A90360384 for ; Thu, 15 Jun 2017 16:36:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CC17285B3 for ; Thu, 15 Jun 2017 16:36:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7167C286AE; Thu, 15 Jun 2017 16:36:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E065285B3 for ; Thu, 15 Jun 2017 16:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751795AbdFOQgo (ORCPT ); Thu, 15 Jun 2017 12:36:44 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:34096 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbdFOQdP (ORCPT ); Thu, 15 Jun 2017 12:33:15 -0400 Received: by mail-wr0-f172.google.com with SMTP id 77so25377629wrb.1 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=M35EmUVrMruwBQK3C02NDo5vDbhbcuXRwymOyEIoBRB9HRCn/hYSRa56gBw2R6DSj1 mpesusYCRDtTeI8QB4RcGEKUsAiaZd134AGy1pRAOEzlyX+mMLf3kEUOlHzIM18K9n/I NSCT30cL12AgEtoCSlCBP/j9AXA44qV+x+AknrcttwJseckyLLPdjRloBJtRiS+bQQtp +0Z2L+8dR0kLkW8KGHM+M7+pwnkCOfT+ksVUEtBLkidR1ixZaY5nJZaMhxi7BgubYqaZ nPG75ImA+//OcKuATmZ+4J7kMb1i4n4AJvQo+k9tsIR0nwOfsd7vPe1w5OPbBzOsloTS Y0Vw== X-Gm-Message-State: AKS2vOynJdvSWCuQIC9x1Y0DAAIvYhxHLTZ6EC9rX62chDs/6LdLYyTa 3HqmFadz11DGGjoH 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-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);