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: 10849129 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63D1714DE for ; Tue, 12 Mar 2019 11:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 503C4295D6 for ; Tue, 12 Mar 2019 11:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43F27295E0; Tue, 12 Mar 2019 11:56:03 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 CE5A1295D6 for ; Tue, 12 Mar 2019 11:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726330AbfCLL4C (ORCPT ); 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-Google-Smtp-Source: APXvYqxP1fqkxdH3SMt1UhyP3rAzpRcs/W5gu+FiNtIcwHS2o+AOzxgI6S0Bj6Ty4h/8sLFSIzZ95g== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);