From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8AD5585966 for ; Wed, 9 Sep 2026 20:40:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788986464; cv=none; b=rWayBnkbk+j2g7uo/iTVBLnyBL5HXIixJ7EpiW/mjS651zZNzUvBmA9gzC+5xak2xaNk0njDvT8rf3HWcdBPlSVhxplGmB939DWLoU8PnEYuzPdPwydYhqYD2vB4PfskU71peij1bust87y8RCn0LHALDfR2kPydbaNt9CAb+Pk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788986464; c=relaxed/simple; bh=V5JXF9xuhHcB9bSbIAWL384a9RlhtX4vE2mq3dg4miE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=lWL/J/MoRdRsokkCzH0wo0zh2c3giMIyTbXyxBlTq1XxbRR4K8zJvBG1afSGxqkk2Lx6R4CgvMlku+aAvLXob3dylSsGVNsF++ZxWR36AoHIiJPK1yduvajM+au/B2LDtkg8J7hwZyXCS+RDwxxQP4YFPlzpF+5lKM8p9Pk/1fs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=pG/oRLv0; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pG/oRLv0" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-49b0d8bc2aaso77268895e9.0 for ; Wed, 09 Sep 2026 13:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788986447; x=1789591247; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JaOoKXT3Y9f1LpI2jFHn6H2wS4bnhm1a37EU+be2Jqo=; b=pG/oRLv09HyJ+yh5FN+2Huz4YF3LonlYx7VKMqppu6f71I5/aVZVDxeLA4rNKKBxJ6 aPcXWXTUtVFGx+dbxcULvKmlyBfyJNMuagKxttDBdlRoHQgTTfCCb8dyKOPE22isOirk OajnWBc8nN8gBQQFyY/Z0G9ugTB+HAmh60AyXlxS7kD42R+sU1SX+xLFmkWjHYxxAbzw YfARWC79Vri9L7iISxkwfFkeLzgPNTylNNj3fyHdDEiq4gymHAygPljyXtVqFznN8+Um R842lwYHJ6L7vUQBzvreKqSXgDtAdkdlnu7R9QzaIlylh3P+97q6zg17iHkCOxr2NJnk l70w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788986447; x=1789591247; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=JaOoKXT3Y9f1LpI2jFHn6H2wS4bnhm1a37EU+be2Jqo=; b=sg1VYID9mr/JvFABGnAGQ/7IFumpQhA/kB5C9A9YHQ11V8X+S2o9zhzOo7FnAJmdj6 86sXBKduXKYISHQY/JKYe6AQjq+Ecv5QI18hONWpXX6sVczz132bRmJ6OEmdjh7G+2/f X7j/2wzVMOv3jnVIe5oLWyv7DpKTcTxmX5exnP/V36//HRlWN3eOXnKJ7XARMUSkXqiR 7NZT4l+o6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by 2002:a05:600c:4f43:b0:49c:fc6c:be0b with SMTP id 5b1f17b1804b1-49cffd457a4mr279515695e9.17.1788986446464; Wed, 09 Sep 2026 13:40:46 -0700 (PDT) Received: from workstation ([85.186.165.159]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49d26c437besm17171315e9.11.2026.09.09.13.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2026 13:40:46 -0700 (PDT) From: =?UTF-8?q?=C8=98tefan=20Ghe=C8=9Bu?= To: Liam Girdwood , Peter Ujfalusi , Bard Liao , Daniel Baluta , Mark Brown Cc: Kai Vehmanen , Pierre-Louis Bossart , Vijendar Mukunda , Jaroslav Kysela , Takashi Iwai , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Ranjani Sridharan , sound-open-firmware@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?=C8=98tefan=20Ghe=C8=9Bu?= Subject: [PATCH] ASoC: SOF: Bound the panic filename print to its array size Date: Wed, 9 Sep 2026 23:40:41 +0300 Message-ID: <20260909204042.46656-1-stefanghetu9@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit struct sof_ipc_panic_info carries the panic location as a fixed 32 byte array, and include/sound/sof/trace.h documents that the "filename array will not include null terminator if fully filled". sof_print_oops_and_stack() prints it with an unbounded %s, so firmware that fills all 32 bytes leaves printk() with no terminator to stop at within the array. It continues into the adjacent linenum field and, if that holds no zero byte either, past the end of the structure into the caller's stack frame, since every IPC3 dbg_dump callback passes a stack allocated struct sof_ipc_panic_info. Use %.*s with SOF_TRACE_FILENAME_SIZE so the print honours the documented bound. Fixes: c16211d6226d ("ASoC: SOF: Add Sound Open Firmware driver core") Signed-off-by: Ștefan Ghețu --- sound/soc/sof/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 2d394389c945..9b0850e87bf6 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -152,7 +152,8 @@ void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level, dev_printk(level, sdev->dev, "trace point: %#010x\n", tracep_code); out: - dev_printk(level, sdev->dev, "panic at %s:%d\n", panic_info->filename, + dev_printk(level, sdev->dev, "panic at %.*s:%d\n", + SOF_TRACE_FILENAME_SIZE, panic_info->filename, panic_info->linenum); sof_oops(sdev, level, oops); sof_stack(sdev, level, oops, stack, stack_words); -- 2.53.0