Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp49948rdb; Sun, 17 Dec 2023 01:32:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaCwHDxZJa6mGnbEXQ/x18jNz9scKu8YJjahhc8qaxzdFPDJ3LkrvRwtXVc99kQURhQvrn X-Received: by 2002:a50:c016:0:b0:552:11fe:a81c with SMTP id r22-20020a50c016000000b0055211fea81cmr4219825edb.26.1702805533562; Sun, 17 Dec 2023 01:32:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702805533; cv=none; d=google.com; s=arc-20160816; b=qhEpXB/3qgmJjpcMAzy62SHA5S2gYUVU0fakTUUocZrOAcwbNRndJkarQ0au2Gz/l+ DuRz38MxWYItJyDwLRjWE568mLg9nmtuBOgVUYGKfChonrkwAwJpLM4Ol0qMNVlZSQzw UNR8WL+JZE6bq0dXH+LDUC1yBssfR7mTsl0sf37VPrSSstjYUsojG6+GwIf4TrdKHiRn H4WdZfaJjsKsbx/C6LWdb3cHztH8q6FWHVr9rJ802IUUPd1wPoJ4G1CstJ1L58ufwAGh 6DXg1FbUHLQlXfRDF6mZEs2m6HdJcKZEGbLwtqfLH9I8ujAf53Q4qilrGx854gvA0bAw MAXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=63aio74ELKT1uUEAVdiZLSilXdr/14V0hT/e6WkdVcc=; fh=/X72HHaXaWNM03rBI0Hxk0xQMFYb/0NWZNsmT3VeaG0=; b=fMTCrzABgeJFiswz8BlsNEGNEfbOxWkZUOGwGo4ndu51IBApYG1+1rIXBYAl28hPg6 fP2B2J4oHKL8hJaW9x0mHLuRJwEqDZAGNT5+QGHUgxzek4XbmjZ+N2udfJZkDDntPmEz RUcWryk0iWNzYNfFsY/vvefRcx4Fe/vmQCt9NGXaYi+QWPU02jOmHupCixY3eBfDgSPv rd2tB+/o6d5x+RWWHAFxY4y6Yw9BWjSrB8iChu45AE3obv6HJtFWfQwQuAo6vZd4cLCa QLJZh4W/0b9LttxVffWBNw+xzKlsqDJUkg4MeR1Q6oYh00HTxk/H9Ic5OlxcdCtexLtZ jloQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="D/WZjZHR"; spf=pass (google.com: domain of linux-kernel+bounces-2514-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2514-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v15-20020a50a44f000000b005406b1cc790si8799152edb.286.2023.12.17.01.32.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 01:32:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2514-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="D/WZjZHR"; spf=pass (google.com: domain of linux-kernel+bounces-2514-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2514-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 509091F220C8 for ; Sun, 17 Dec 2023 09:32:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13F4F566E; Sun, 17 Dec 2023 09:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="D/WZjZHR" X-Original-To: linux-kernel@vger.kernel.org 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 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: 8bit When compiled with W=1, we get: arch/x86/kernel/callthunks.c: In function ‘callthunks_debugfs_init’: arch/x86/kernel/callthunks.c:394:35: error: ‘%lu’ directive writing between 1 and 10 bytes into a region of size 7 [-Werror=format-overflow=] 394 | sprintf(name, "cpu%lu", cpu); | ^~~ arch/x86/kernel/callthunks.c:394:31: note: directive argument in the range [0, 4294967294] 394 | sprintf(name, "cpu%lu", cpu); | ^~~~~~~~ arch/x86/kernel/callthunks.c:394:17: note: ‘sprintf’ output 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 --- 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 = debugfs_create_dir("callthunks", NULL); for_each_possible_cpu(cpu) { void *arg = (void *)cpu; - char name [10]; + char name[14]; sprintf(name, "cpu%lu", cpu); debugfs_create_file(name, 0644, dir, arg, &dfs_ops); -- 2.34.1