All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: get_user: set the parameter @x to zero on error
@ 2014-11-18  6:34 ` bin.jiang
  0 siblings, 0 replies; 5+ messages in thread
From: bin.jiang @ 2014-11-18  6:34 UTC (permalink / raw)
  To: linux-mips; +Cc: bin.jiang, ralf

From: Bin Jiang <bin.jiang@windriver.com>

The following compile warning is caused to use uninitialized variables:

fs/compat_ioctl.c: In function 'compat_SyS_ioctl':
arch/mips/include/asm/uaccess.h:451:2: warning: 'length' may be used \
                uninitialized in this function [-Wmaybe-uninitialized]
  __asm__ __volatile__(      \
  ^
fs/compat_ioctl.c:208:6: note: 'length' was declared here
  int length, err;
      ^

In get_user function, the parameter @x is used to store result. If the
function return error, the @x won't be set and cause above warning.

According to the description of get_user function, the parameter @x should
be set to zero on error.

Signed-off-by: Bin Jiang <bin.jiang@windriver.com>
---
 arch/mips/include/asm/uaccess.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index a109510..07e9755 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -301,7 +301,8 @@ do {									\
 			__get_kernel_common((x), size, __gu_ptr);	\
 		else							\
 			__get_user_common((x), size, __gu_ptr);		\
-	}								\
+	} else								\
+		(x) = (__typeof__(*(ptr)))0;				\
 									\
 	__gu_err;							\
 })
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-18 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-18  6:34 [PATCH] MIPS: get_user: set the parameter @x to zero on error bin.jiang
2014-11-18  6:34 ` bin.jiang
2014-11-18 11:22 ` Ralf Baechle
2014-11-18 17:19   ` Ralf Baechle
2014-11-18 20:48     ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.