From: Amadeusz Sławiński Date: Fri, 27 Jan 2023 23:11:01 +0000 (+0100) Subject: ASoC: topology: Properly access value coming from topology file X-Git-Tag: v6.1.21~1106 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eee97569465a838c91237c7bba85f89e2a0649cf;p=platform%2Fkernel%2Flinux-starfive.git ASoC: topology: Properly access value coming from topology file [ Upstream commit c5d184c92df2b631fb81fe2ce6e96bfc5ba720e5 ] 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 Link: https://lore.kernel.org/r/20230127231111.937721-2-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index a79a2fb2..d68c485 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -2408,7 +2408,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),