From nobody Sun Jun 14 14:33:35 2026 Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC4621FCFFC for ; Sat, 4 Apr 2026 08:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775292690; cv=none; b=bqSvZ1R1cWtfj9hupD2qY9Pysv/PI9oBtD+VZim5j/yCkzSnTXAUylbTnL4L1CZ8O7V4aoJ8q1qvgkCddD5qkK+gY5DdqdisO/Xremd0eyHOPl7BGFzWsf6KtAJpibdG7U+5y+K5wE1b++7+PqKuRdEhvr+PgnkjALpEWSU1p5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775292690; c=relaxed/simple; bh=93t8EhwDy6HbEGcMbLDQo29lajwmoAS9Yt75lWzl6Cw=; h=From:Date:Message-ID:To:Cc:Subject; b=gdkWyn4CthGAFCj7gh/c04uFWARbq3WXCBF2e+341tQsipZzf2PiVook32PPd/gLGYTLOVSBQfhrnAdmZp8ibXrv6C9s1AUUk+CwHGM+2RASABJtEPnmAXzs6KGdqQB9dmlpBg7x5hBXgu1EhVdv3XkSixzHJbdVcNFDssxvOa0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from 0001-genirq-proc.eml (unknown [111.196.245.197]) by APP-05 (Coremail) with SMTP id zQCowADHWQ0F0dBp7LRzDA--.43404S2; Sat, 04 Apr 2026 16:51:18 +0800 (CST) From: Pengpeng Hou Date: Fri, 3 Apr 2026 16:55:56 +0800 Message-ID: <20260404101001.1-genirq-proc-pengpeng@iscas.ac.cn> To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, pengpeng@iscas.ac.cn Subject: [PATCH] genirq/proc: size IRQ directory names for 10-digit IRQ values X-CM-TRANSID: zQCowADHWQ0F0dBp7LRzDA--.43404S2 X-Coremail-Antispam: 1UD129KBjvJXoW7AF15JF18JF17tw1DKw4DArb_yoW8ArWrpF Wv9a15tr4rWr47Xay5ZFsYkFy5X3Z5XrZFyFsIqw4IvrnIq34qqrZ8Gr1ayr18ur4Fka1j vFZ0gws3Cw45uF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK6x804I0_Grv_XF1l8cAvFVAK0II2c7 xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE 2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwV C2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC 0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr 1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIF xwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r 1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij 64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr 0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7VUbWCJPUUUUU== X-CM-SenderInfo: pshqw1xhqjqxpvfd2hldfou0/ Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" `/proc/irq//` directory names are built in `char name[10]` buffers with `sprintf(name, "%u", irq)`. Ten-digit IRQ numbers already need 11 bytes including the trailing NUL, and current sparse-IRQ configurations still allow IRQ numbers in that range. Size the temporary name buffer for the current decimal form and switch to bounded formatting when creating or removing the proc entry. Signed-off-by: Pengpeng Hou --- kernel/irq/proc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index b0999a4f1f68..dfa0b0723642 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -326,7 +327,7 @@ void register_handler_proc(unsigned int irq, struct irq= action *action) =20 #undef MAX_NAMELEN =20 -#define MAX_NAMELEN 10 +#define MAX_NAMELEN 11 =20 void register_irq_proc(unsigned int irq, struct irq_desc *desc) { @@ -348,7 +349,7 @@ void register_irq_proc(unsigned int irq, struct irq_des= c *desc) return; =20 /* create /proc/irq/1234 */ - sprintf(name, "%u", irq); + snprintf(name, MAX_NAMELEN, "%u", irq); desc->dir =3D proc_mkdir(name, root_irq_dir); if (!desc->dir) return; @@ -401,7 +402,7 @@ void unregister_irq_proc(unsigned int irq, struct irq_d= esc *desc) #endif remove_proc_entry("spurious", desc->dir); =20 - sprintf(name, "%u", irq); + snprintf(name, MAX_NAMELEN, "%u", irq); remove_proc_entry(name, root_irq_dir); } =20 --=20 2.50.1 (Apple Git-155)