From nobody Fri Dec 19 08:09:38 2025 Received: from smtp.smtpout.orange.fr (smtp-22.smtpout.orange.fr [80.12.242.22]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 292453C16 for ; Sun, 17 Dec 2023 09:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="D/WZjZHR" Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id En1qrv0j2VbkuEn1rrXCqJ; Sun, 17 Dec 2023 10:01:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702803706; bh=63aio74ELKT1uUEAVdiZLSilXdr/14V0hT/e6WkdVcc=; h=From:To:Cc:Subject:Date; b=D/WZjZHR/ZFs86Xjnq0fLW7hnkiyAtRJPcFacZxIwfpGg2NoABPXaTG4pWCsgrUje MS0p3aGJ8V8gxSLGVuHlUdt2XGSq1KlbWMguUDocFBGSe5ozu2LUQ7sP/5Nhl7Us/U njMX7qO7w/9lEpRmz/NkfT/vXTTRPqfb4TkYq2ThLour4plxm9lClz3JrTLzs49ET/ OFSR2XrfpSYriR5JP00PBvxRetv3eFzoaoKVdOCKkcJmYXKMnvUNYZwPEv+DAevSDs yPUKLnX+9m++Qw669t0I8jFpWaFH5UlN5Brt7i6yYNOZAiq7NQ3ALzoLIyqCVwz/Ru 4dMbgmVx7t98w== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 17 Dec 2023 10:01:46 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] x86/callthunks: Fix some potential string truncation in callthunks_debugfs_init() Date: Sun, 17 Dec 2023 10:01:41 +0100 Message-Id: <8c2b24df3c077e55b2a4d91a7ffd08fa48e28d0a.1702803679.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 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: quoted-printable When compiled with W=3D1, we get: arch/x86/kernel/callthunks.c: In function =E2=80=98callthunks_debugfs_ini= t=E2=80=99: arch/x86/kernel/callthunks.c:394:35: error: =E2=80=98%lu=E2=80=99 directi= ve writing between 1 and 10 bytes into a region of size 7 [-Werror=3Dformat= -overflow=3D] 394 | sprintf(name, "cpu%lu", cpu); | ^~~ arch/x86/kernel/callthunks.c:394:31: note: directive argument in the rang= e [0, 4294967294] 394 | sprintf(name, "cpu%lu", cpu); | ^~~~~~~~ arch/x86/kernel/callthunks.c:394:17: note: =E2=80=98sprintf=E2=80=99 outp= ut between 5 and 14 bytes into a destination of size 10 394 | sprintf(name, "cpu%lu", cpu); | So, give some more space to 'name' to silence the warning. (and fix the issue should a lucky one have a config with so many CPU!) Signed-off-by: Christophe JAILLET Reviewed-by: Sohil Mehta --- arch/x86/kernel/callthunks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/callthunks.c b/arch/x86/kernel/callthunks.c index cf7e5be1b844..26182a7d12b3 100644 --- a/arch/x86/kernel/callthunks.c +++ b/arch/x86/kernel/callthunks.c @@ -388,7 +388,7 @@ static int __init callthunks_debugfs_init(void) dir =3D debugfs_create_dir("callthunks", NULL); for_each_possible_cpu(cpu) { void *arg =3D (void *)cpu; - char name [10]; + char name[14]; =20 sprintf(name, "cpu%lu", cpu); debugfs_create_file(name, 0644, dir, arg, &dfs_ops); --=20 2.34.1