Skip to contentSkip to conversation

add gcc printf format checking and fix wrong format in speedstep-smi.c

PATCH In review Helge Deller 1 participant 2 messages Jan 6, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add gcc printf format checking and fix wrong format in speedstep-smi.c

[PATCH] [CPUFREQ] add gcc printf format checking to cpufreq.h

ist_info.signature and the other variables in speedstep-smi.c are of type "unsigned int", not "unsigned long". Detected with the added printf format check.

include/linux/cpufreq.h +1 -1
index 23932d7..7a276a6 100644
@@ -365,7 +365,7 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu);
 #ifdef CONFIG_CPU_FREQ_DEBUG
 
 extern void cpufreq_debug_printk(unsigned int type, const char *prefix, 
-				 const char *fmt, ...);
+				 const char *fmt, ...) __printf(3,4);
 
 #else
 
arch/x86/kernel/cpu/cpufreq/speedstep-smi.c +1 -1
index f2b5a62..f0dffe9 100644
@@ -368,7 +368,7 @@ static int __init speedstep_init(void)
 		return -ENODEV;
 	}
 
-	dprintk("signature:0x%.8lx, command:0x%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n",
+	dprintk("signature:0x%.8x, command:0x%.8x, event:0x%.8x, perf_level:0x%.8x.\n",
 		ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level);
 
 	/* Error if no IST-SMI BIOS or no PARM
#1 lore raw

Updated patch below
==============

[PATCH] [CPUFREQ] add gcc printf format checking to cpufreq.h

ist_info.signature and the other variables in speedstep-smi.c are of type "unsigned int", not "unsigned long". Detected with the added printf format check.

arch/x86/kernel/cpu/cpufreq/speedstep-smi.c +1 -1
index f2b5a62..f0dffe9 100644
@@ -368,7 +368,7 @@ static int __init speedstep_init(void)
 		return -ENODEV;
 	}
 
-	dprintk("signature:0x%.8lx, command:0x%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n",
+	dprintk("signature:0x%.8x, command:0x%.8x, event:0x%.8x, perf_level:0x%.8x.\n",
 		ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level);
 
 	/* Error if no IST-SMI BIOS or no PARM
include/linux/cpufreq.h +1 -1
index 23932d7..774add6 100644
@@ -365,7 +365,7 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu);
 #ifdef CONFIG_CPU_FREQ_DEBUG
 
 extern void cpufreq_debug_printk(unsigned int type, const char *prefix, 
-				 const char *fmt, ...);
+		const char *fmt, ...) __attribute__ ((format(printf,3,4)));
 
 #else