lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <52529133.4040200@asianux.com>
Date:	Mon, 07 Oct 2013 18:47:15 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Richard Weinberger <richard@....at>
CC:	Richard Weinberger <richard.weinberger@...il.com>,
	Joe Perches <joe@...ches.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Thomas Gleixner <tglx@...utronix.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH v2] kernel/irq/proc.c: set MAX_NAMELEN 11 instead of 10 and
 use "%u" instead of "%d" for printing 'irq'

Theoretically, the maximize size of "%u" is 11 (10 + '\0'), so need set
MAX_NAMELEN 11 instead of 10, and also 'irq' is unsigned int, so need
use "%u" instead of "%d".

In real world, it may not cause issue, but still recommend to fix the
'theoretical' bugs (especially original definition already considered
about 'theoretical' using).


Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
 kernel/irq/proc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 36f6ee1..efda701 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -305,7 +305,7 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
 
 #undef MAX_NAMELEN
 
-#define MAX_NAMELEN 10
+#define MAX_NAMELEN 11
 
 void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 {
@@ -315,7 +315,7 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
 		return;
 
 	memset(name, 0, MAX_NAMELEN);
-	sprintf(name, "%d", irq);
+	sprintf(name, "%u", irq);
 
 	/* create /proc/irq/1234 */
 	desc->dir = proc_mkdir(name, root_irq_dir);
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ