From patchwork Fri Jan 27 23:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 647991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41715C61DA3 for ; Fri, 27 Jan 2023 15:11:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BEE8193A; Fri, 27 Jan 2023 16:10:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BEE8193A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674832298; bh=LvKTiEZRlMazR+r++JvGSgZfrTxuCnGAk8uY0I0iui8=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=aQhLp1goC9n+ZreWXlE49hBt9ZxbQikr70UWm4kj2ChGkthHWy1//NKvLgFKWYm6e on/OvnCWm0lFkBWEcc9+3nXYjmr/DD+ngj5tOAAAEjulO2GMHpQ6bWJclCqBInM5ge mRBu58z0RwAzoneIfu/HoBXWIGDz3S2XJaJ2oRBw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 13029F8007C; Fri, 27 Jan 2023 16:10:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6D1FBF804F3; Fri, 27 Jan 2023 16:10:20 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2A196F8007C for ; Fri, 27 Jan 2023 16:10:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2A196F8007C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=cgN1xjfp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674832217; x=1706368217; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LvKTiEZRlMazR+r++JvGSgZfrTxuCnGAk8uY0I0iui8=; b=cgN1xjfpNqj3H/WX5qglLZ0HQQ4UNYvMlyckfhu/fzsEiIpzfHKN3KGO aj+G8P4siR5HnPGUDGuPkRIBPk0BVwkgtVsGogMT/RcCS1HAq8aZ6uyGz jmjRPMppzYA4cQWV6BozZ2/2L6GNhoFmZD5ZkR+F1WPkNrDF2tfovN3nF APvmLW1F1q43ABYJSHOmdAj28MOLAv+ZRSvf0X0Ghn6+24vUrEzDAT12q QYeudD15Zoq099VRZtDWNuSsoLx5uDSSomU5lUZ+43gs3sydBBMgk7tIp HbsDi7KjdUFHfXArw6MW+YprGXFORHF72qoh5sV1lng8z2iGXb8agydS8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10603"; a="324795769" X-IronPort-AV: E=Sophos;i="5.97,251,1669104000"; d="scan'208";a="324795769" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2023 07:10:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10603"; a="908708985" X-IronPort-AV: E=Sophos;i="5.97,251,1669104000"; d="scan'208";a="908708985" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga006.fm.intel.com with ESMTP; 27 Jan 2023 07:10:11 -0800 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Subject: [PATCH 01/11] ASoC: topology: Properly access value coming from topology file Date: Sat, 28 Jan 2023 00:11:01 +0100 Message-Id: <20230127231111.937721-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127231111.937721-1-amadeuszx.slawinski@linux.intel.com> References: <20230127231111.937721-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Pierre-Louis Bossart , Ranjani Sridharan , =?utf-8?q?Amadeusz_S?= =?utf-8?q?=C5=82awi=C5=84ski?= Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When accessing values coming from topology, le32_to_cpu should be used. One of recent commits missed that. Fixes: 86e2d14b6d1a ("ASoC: topology: Add header payload_size verification") Reviewed-by: Cezary Rojewski Reviewed-by: Ranjani Sridharan Signed-off-by: Amadeusz Sławiński --- sound/soc/soc-topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index c3be24b2fac5..b9addbab2b3d 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2404,7 +2404,7 @@ static int soc_valid_header(struct soc_tplg *tplg, return -EINVAL; } - if (soc_tplg_get_hdr_offset(tplg) + hdr->payload_size >= tplg->fw->size) { + if (soc_tplg_get_hdr_offset(tplg) + le32_to_cpu(hdr->payload_size) >= tplg->fw->size) { dev_err(tplg->dev, "ASoC: invalid header of type %d at offset %ld payload_size %d\n", le32_to_cpu(hdr->type), soc_tplg_get_hdr_offset(tplg),