Skip to contentSkip to conversation

x86: fix sparse warnings in ptrace.c

PATCH New Simon Arlott 1 participant 1 message Nov 14, 2008

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

PATCH 1/1 x86: fix sparse warnings in ptrace.c

arch/x86/kernel/ptrace.c:634:32: error: incompatible types for operation (*)
arch/x86/kernel/ptrace.c:634:32: left side has type unsigned char static [unsigned] [toplevel] sizeof_field
arch/x86/kernel/ptrace.c:634:32: right side has type bad type enum bts_field field
arch/x86/kernel/ptrace.c:634:7: error: invalid assignment

arch/x86/kernel/ptrace.c:640:32: error: incompatible types for operation (*)
arch/x86/kernel/ptrace.c:640:32: left side has type unsigned char static [unsigned] [toplevel] sizeof_field
arch/x86/kernel/ptrace.c:640:32: right side has type bad type enum bts_field field
arch/x86/kernel/ptrace.c:640:7: error: invalid assignment

---
 arch/x86/kernel/ptrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/ptrace.c +2 -2
index 0a6d8c1..662a400 100644
@@ -631,13 +631,13 @@ enum bts_field {
 
 static inline unsigned long bts_get(const char *base, enum bts_field field)
 {
-	base += (bts_cfg.sizeof_field * field);
+	base += (bts_cfg.sizeof_field * (unsigned char)field);
 	return *(unsigned long *)base;
 }
 
 static inline void bts_set(char *base, enum bts_field field, unsigned long val)
 {
-	base += (bts_cfg.sizeof_field * field);;
+	base += (bts_cfg.sizeof_field * (unsigned char)field);
 	(*(unsigned long *)base) = val;
 }
 
Signature · 4 lines
1.6.0.3

-- 
Simon Arlott