Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb83da05 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

[PATCH] uml: fix build warnings in __get_user



Fix a gcc warning about losing qualifiers to the first argument of
copy_from_user.  The typeof change for correctness, and fixes a lot of the
warnings, but there are some cases where x has some extra qualifiers, like
volatile, which copy_from_user can't know about.  For these, the void * cast
seems to be necessary.

Also cleaned up some of the whitespace and got rid of the emacs comment at the
bottom.

Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dbffa471
Loading
Loading
Loading
Loading
+10 −21
Original line number Original line Diff line number Diff line
@@ -42,10 +42,10 @@
#define __get_user(x, ptr) \
#define __get_user(x, ptr) \
({ \
({ \
	const __typeof__(ptr) __private_ptr = ptr;	\
	const __typeof__(ptr) __private_ptr = ptr;	\
        __typeof__(*(__private_ptr)) __private_val; \
	__typeof__(x) __private_val;			\
	int __private_ret = -EFAULT;			\
	int __private_ret = -EFAULT;			\
	(x) = (__typeof__(*(__private_ptr)))0;				\
	(x) = (__typeof__(*(__private_ptr)))0;				\
	if (__copy_from_user(&__private_val, (__private_ptr), \
	if (__copy_from_user((void *) &__private_val, (__private_ptr),	\
			     sizeof(*(__private_ptr))) == 0) {		\
			     sizeof(*(__private_ptr))) == 0) {		\
		(x) = (__typeof__(*(__private_ptr))) __private_val;	\
		(x) = (__typeof__(*(__private_ptr))) __private_val;	\
		__private_ret = 0;					\
		__private_ret = 0;					\
@@ -89,14 +89,3 @@ struct exception_table_entry
};
};


#endif
#endif

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * Emacs will notice this stuff at the end of the file and automatically
 * adjust the settings for this buffer only.  This must remain at the end
 * of the file.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-file-style: "linux"
 * End:
 */