From patchwork Tue Mar 12 11:55:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 160091 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp13014667jad; Tue, 12 Mar 2019 04:56:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSK+Eo8Z5GYQUwBE3YnHs/bBGAUuGoeQp4l2Ze4GqhTo0FSPhBGH/e88cZYluKb8La5COe X-Received: by 2002:a17:902:7d89:: with SMTP id a9mr38843198plm.33.1552391764380; Tue, 12 Mar 2019 04:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552391764; cv=none; d=google.com; s=arc-20160816; b=jTXqNDUMYPFAOW1rGBx7z2YfoCS6uDDJHJFLS7cIh1Nci5U0xypfegx1OrgmQROGzC jlvnqhfjL6vK4NPMPEXA0RtoaHbb+pGCgTyljhrSSdj1pbYWgCV18qcl137ZmvVSigQR OusPAWlHRvIfMv/8gsESAQ4CUjutdmvqDQmmti6IujTgeto6iz+d32WRXOF3OgwDHVr0 yVBQz60Y6j5uxLYb9cBid2dAJozSnlUBgo+8f8lj8e1yrNAeRM301STL8Dtaq5sefE8A Tf68Uhb/RwzyfM6EomVYCvRdtGOmihoJbtwNda257rnE0Xh6ywItmrTGVD3kkisNgPfS xUYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=sP1UMbnvXffQFvwNd2Kjky712sNdl4eU3YJAbGKjznc=; b=rw/vL0YKxP0883ZFBM0i1lV41hu2MdUBOBgKA8JvHSw8Sq38TGi2rqEzAtkSlxCK1l rKEq3Kxlkh4MSmtt1ak0rf8AcCyKS83Bo9lWF9TmRuGuVXqoMkbKdWOsYBnoN4U3MgZg vIaiUQMaWa4kkyd4XnxJ12CMSdt6yErcpLo+YsLpGHkQ34xuHd387vSucicmhnm4a6hX w8yjR6z5BV2Viaf93H4Pza/+dqI7tAVhV8zFXuS00WCKa7o04zWr2q5fp1Igc2X2fis2 MKGkKwZtXu7DjEpwNbRH/qmCvhlc+6rFegF8gYwHSWUgMo4RTK4idclOZBTWujDrd3a+ NyPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GChF3YJo; 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=pass (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 i10si7718370pfj.186.2019.03.12.04.56.02; Tue, 12 Mar 2019 04:56:04 -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=pass header.i=@linaro.org header.s=google header.b=GChF3YJo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726330AbfCLL4C (ORCPT + 15 others); Tue, 12 Mar 2019 07:56:02 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41868 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbfCLL4B (ORCPT ); Tue, 12 Mar 2019 07:56:01 -0400 Received: by mail-wr1-f65.google.com with SMTP id p1so2364476wrs.8 for ; Tue, 12 Mar 2019 04:56:00 -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; bh=sP1UMbnvXffQFvwNd2Kjky712sNdl4eU3YJAbGKjznc=; b=GChF3YJos7jICxEpgt1qCMpaR0U4BrV05oTTishBHMbSLq1KNQXY5WE0v0RpAdAMHE QCdqAkOr8Rw2m/UorsIgozuH9ZT3SA6FYR4ODWKoRme5IAOEnBEIRDqqmCe4N/j+oa3q BKadL0GjhUp5u0FtnirgNZKB/YZW/F3i+zxQfFzk3kOJv6Htq5a2OfVHvmj6AZXfqsPo /2Reiig3neOd5+04a3w2EbAbapE4CKSHMlBVvNoDdvk2g0Ke0TkDgfFOBRcnQUuVH+bL kGN2vl51KFW+c+PrglW6p1LCFurTR9mkfK608cF2LzwgWmpXpvIBzrNizgi9SHM17DD5 z5xQ== 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; bh=sP1UMbnvXffQFvwNd2Kjky712sNdl4eU3YJAbGKjznc=; b=Fyr2Vp5E/QbddnZvUuOUwhM+iAhhaG7WsSoYpwjKpX2peWCaetGoLNUynziqz+2SM4 PgjHHPflbx5a1XVEYs8ShrwwCm+TXJoKFHTV6Kl30Mx0AdN52aiZxkjApOXCw61lj8JM 8qc4IhyWHjEBI1vLg4nzeSEVj2heaCVmoScrSTBQ60hc/lGciSyq+X4ctSWDspM+z0ib vDngthj6HtntzVeB6HUtr2hs1pupD5DG0g5Nc7AGe0OCevGUk2dfhl5swbHcXgNmP60O SX+8sKBUXKIHC6ZwQNoRPnJcPzHlwlT45thk+W5w04XQM7OSI8ucEP4+eH8ytzgJAICj bUsg== X-Gm-Message-State: APjAAAUoxJsXqTM8JWMNeEADx95gARPaPmTkAJCgFCJkZKJAROiHeNvE y7ySaeDGNuZuX17qxRpZRWKFSA== X-Received: by 2002:adf:fd01:: with SMTP id e1mr18313385wrr.204.1552391760145; Tue, 12 Mar 2019 04:56:00 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id x22sm2064990wmc.19.2019.03.12.04.55.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 04:55:59 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Hans Verkuil , Stanimir Varbanov Subject: [PATCH] venus: hfi_parser: fix Source Matcher errors Date: Tue, 12 Mar 2019 13:55:42 +0200 Message-Id: <20190312115542.15638-1-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This fixes following Smatch errors: hfi_parser.c:103 parse_profile_level() error: memcpy() 'proflevel' too small (8 vs 128) hfi_parser.c:129 parse_caps() error: memcpy() 'cap' too small (16 vs 512) Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_parser.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c index 2293d936e49c..d8b34a7a825f 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -96,11 +96,15 @@ parse_profile_level(struct venus_core *core, u32 codecs, u32 domain, void *data) struct hfi_profile_level_supported *pl = data; struct hfi_profile_level *proflevel = pl->profile_level; struct hfi_profile_level pl_arr[HFI_MAX_PROFILE_COUNT] = {}; + unsigned int i; if (pl->profile_count > HFI_MAX_PROFILE_COUNT) return; - memcpy(pl_arr, proflevel, pl->profile_count * sizeof(*proflevel)); + for (i = 0; i < pl->profile_count; i++) { + pl_arr[i] = *proflevel; + proflevel++; + } for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, fill_profile_level, pl_arr, pl->profile_count); @@ -122,11 +126,15 @@ parse_caps(struct venus_core *core, u32 codecs, u32 domain, void *data) struct hfi_capability *cap = caps->data; u32 num_caps = caps->num_capabilities; struct hfi_capability caps_arr[MAX_CAP_ENTRIES] = {}; + unsigned int i; if (num_caps > MAX_CAP_ENTRIES) return; - memcpy(caps_arr, cap, num_caps * sizeof(*cap)); + for (i = 0; i < num_caps; i++) { + caps_arr[i] = *cap; + cap++; + } for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, fill_caps, caps_arr, num_caps);