Skip to contentSkip to conversation

POWERPC: Fix uninitialized variable bug in copy_{to|from}_user

PATCH New Nate Case 1 participant 1 message May 12, 2008

lore
Share & tools
lore

Nate Case

author
#0 lore raw

PATCH 1/1 POWERPC: Fix uninitialized variable bug in copy_{to|from}_user

Calls to copy_to_user() or copy_from_user() can fail when copying N bytes, where N is a constant less than 8, but not 1, 2, 4, or 8.

---
 include/asm-powerpc/uaccess.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/asm-powerpc/uaccess.h +2 -2
index 8e798e3..1a0736f 100644
@@ -380,7 +380,7 @@ static inline unsigned long __copy_from_user_inatomic(void *to,
 		const void __user *from, unsigned long n)
 {
 	if (__builtin_constant_p(n) && (n <= 8)) {
-		unsigned long ret;
+		unsigned long ret = 1;
 
 		switch (n) {
 		case 1:
@@ -406,7 +406,7 @@ static inline unsigned long __copy_to_user_inatomic(void __user *to,
 		const void *from, unsigned long n)
 {
 	if (__builtin_constant_p(n) && (n <= 8)) {
-		unsigned long ret;
+		unsigned long ret = 1;
 
 		switch (n) {
 		case 1:
Signature · 1 line
1.5.4.4