[PATCH 04/12] making the kernel -Wshadow clean - warnings related to 'up'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix a few -Wshadow warnings related to variables of the name 'up' clashing 
with the global function name up() by renaming the variables.


Signed-off-by: Jesper Juhl <[email protected]>
---

 drivers/char/vt_ioctl.c |   60 +++++++++++++++++++-------------------
 fs/select.c             |    6 +--
 kernel/user.c           |   36 +++++++++++-----------
 3 files changed, 51 insertions(+), 51 deletions(-)

--- linux-2.6.18-rc2-orig/drivers/char/vt_ioctl.c	2006-07-18 18:46:23.000000000 +0200
+++ linux-2.6.18-rc2/drivers/char/vt_ioctl.c	2006-07-18 21:21:39.000000000 +0200
@@ -187,7 +187,7 @@ do_kdgkb_ioctl(int cmd, struct kbsentry 
 	struct kbsentry *kbs;
 	char *p;
 	u_char *q;
-	u_char __user *up;
+	u_char __user *u;
 	int sz;
 	int delta;
 	char *first_free, *fj, *fnw;
@@ -215,15 +215,15 @@ do_kdgkb_ioctl(int cmd, struct kbsentry 
 	case KDGKBSENT:
 		sz = sizeof(kbs->kb_string) - 1; /* sz should have been
 						  a struct member */
-		up = user_kdgkb->kb_string;
+		u = user_kdgkb->kb_string;
 		p = func_table[i];
 		if(p)
 			for ( ; *p && sz; p++, sz--)
-				if (put_user(*p, up++)) {
+				if (put_user(*p, u++)) {
 					ret = -EFAULT;
 					goto reterr;
 				}
-		if (put_user('\0', up)) {
+		if (put_user('\0', u)) {
 			ret = -EFAULT;
 			goto reterr;
 		}
@@ -370,7 +370,7 @@ int vt_ioctl(struct tty_struct *tty, str
 	struct kbd_struct * kbd;
 	unsigned int console;
 	unsigned char ucval;
-	void __user *up = (void __user *)arg;
+	void __user *u = (void __user *)arg;
 	int i, perm;
 	
 	console = vc->vc_num;
@@ -454,12 +454,12 @@ int vt_ioctl(struct tty_struct *tty, str
 		if (!capable(CAP_SYS_TTY_CONFIG))
 			return -EPERM;
 
-		if (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat)))
+		if (copy_from_user(&kbrep, u, sizeof(struct kbd_repeat)))
 			return -EFAULT;
 		err = kbd_rate(&kbrep);
 		if (err)
 			return err;
-		if (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))
+		if (copy_to_user(u, &kbrep, sizeof(struct kbd_repeat)))
 			return -EFAULT;
 		return 0;
 	}
@@ -569,19 +569,19 @@ int vt_ioctl(struct tty_struct *tty, str
 	case KDSETKEYCODE:
 		if(!capable(CAP_SYS_TTY_CONFIG))
 			perm=0;
-		return do_kbkeycode_ioctl(cmd, up, perm);
+		return do_kbkeycode_ioctl(cmd, u, perm);
 
 	case KDGKBENT:
 	case KDSKBENT:
-		return do_kdsk_ioctl(cmd, up, perm, kbd);
+		return do_kdsk_ioctl(cmd, u, perm, kbd);
 
 	case KDGKBSENT:
 	case KDSKBSENT:
-		return do_kdgkb_ioctl(cmd, up, perm);
+		return do_kdgkb_ioctl(cmd, u, perm);
 
 	case KDGKBDIACR:
 	{
-		struct kbdiacrs __user *a = up;
+		struct kbdiacrs __user *a = u;
 
 		if (put_user(accent_table_size, &a->kb_cnt))
 			return -EFAULT;
@@ -592,7 +592,7 @@ int vt_ioctl(struct tty_struct *tty, str
 
 	case KDSKBDIACR:
 	{
-		struct kbdiacrs __user *a = up;
+		struct kbdiacrs __user *a = u;
 		unsigned int ct;
 
 		if (!perm)
@@ -661,7 +661,7 @@ int vt_ioctl(struct tty_struct *tty, str
 
 		if (!perm)
 			return -EPERM;
-		if (copy_from_user(&tmp, up, sizeof(struct vt_mode)))
+		if (copy_from_user(&tmp, u, sizeof(struct vt_mode)))
 			return -EFAULT;
 		if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS)
 			return -EINVAL;
@@ -685,7 +685,7 @@ int vt_ioctl(struct tty_struct *tty, str
 		memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
 		release_console_sem();
 
-		rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
+		rc = copy_to_user(u, &tmp, sizeof(struct vt_mode));
 		return rc ? -EFAULT : 0;
 	}
 
@@ -696,7 +696,7 @@ int vt_ioctl(struct tty_struct *tty, str
 	 */
 	case VT_GETSTATE:
 	{
-		struct vt_stat __user *vtstat = up;
+		struct vt_stat __user *vtstat = u;
 		unsigned short state, mask;
 
 		if (put_user(fg_console + 1, &vtstat->v_active))
@@ -840,7 +840,7 @@ int vt_ioctl(struct tty_struct *tty, str
 
 	case VT_RESIZE:
 	{
-		struct vt_sizes __user *vtsizes = up;
+		struct vt_sizes __user *vtsizes = u;
 		ushort ll,cc;
 		if (!perm)
 			return -EPERM;
@@ -857,7 +857,7 @@ int vt_ioctl(struct tty_struct *tty, str
 
 	case VT_RESIZEX:
 	{
-		struct vt_consize __user *vtconsize = up;
+		struct vt_consize __user *vtconsize = u;
 		ushort ll,cc,vlin,clin,vcol,ccol;
 		if (!perm)
 			return -EPERM;
@@ -911,7 +911,7 @@ int vt_ioctl(struct tty_struct *tty, str
 		op.width = 8;
 		op.height = 0;
 		op.charcount = 256;
-		op.data = up;
+		op.data = u;
 		return con_font_op(vc_cons[fg_console].d, &op);
 	}
 
@@ -921,21 +921,21 @@ int vt_ioctl(struct tty_struct *tty, str
 		op.width = 8;
 		op.height = 32;
 		op.charcount = 256;
-		op.data = up;
+		op.data = u;
 		return con_font_op(vc_cons[fg_console].d, &op);
 	}
 
 	case PIO_CMAP:
                 if (!perm)
 			return -EPERM;
-                return con_set_cmap(up);
+                return con_set_cmap(u);
 
 	case GIO_CMAP:
-                return con_get_cmap(up);
+                return con_get_cmap(u);
 
 	case PIO_FONTX:
 	case GIO_FONTX:
-		return do_fontx_ioctl(cmd, up, perm, &op);
+		return do_fontx_ioctl(cmd, u, perm, &op);
 
 	case PIO_FONTRESET:
 	{
@@ -960,13 +960,13 @@ int vt_ioctl(struct tty_struct *tty, str
 	}
 
 	case KDFONTOP: {
-		if (copy_from_user(&op, up, sizeof(op)))
+		if (copy_from_user(&op, u, sizeof(op)))
 			return -EFAULT;
 		if (!perm && op.op != KD_FONT_OP_GET)
 			return -EPERM;
 		i = con_font_op(vc, &op);
 		if (i) return i;
-		if (copy_to_user(up, &op, sizeof(op)))
+		if (copy_to_user(u, &op, sizeof(op)))
 			return -EFAULT;
 		return 0;
 	}
@@ -974,24 +974,24 @@ int vt_ioctl(struct tty_struct *tty, str
 	case PIO_SCRNMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_trans_old(up);
+		return con_set_trans_old(u);
 
 	case GIO_SCRNMAP:
-		return con_get_trans_old(up);
+		return con_get_trans_old(u);
 
 	case PIO_UNISCRNMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_trans_new(up);
+		return con_set_trans_new(u);
 
 	case GIO_UNISCRNMAP:
-		return con_get_trans_new(up);
+		return con_get_trans_new(u);
 
 	case PIO_UNIMAPCLR:
 	      { struct unimapinit ui;
 		if (!perm)
 			return -EPERM;
-		i = copy_from_user(&ui, up, sizeof(struct unimapinit));
+		i = copy_from_user(&ui, u, sizeof(struct unimapinit));
 		if (i) return -EFAULT;
 		con_clear_unimap(vc, &ui);
 		return 0;
@@ -999,7 +999,7 @@ int vt_ioctl(struct tty_struct *tty, str
 
 	case PIO_UNIMAP:
 	case GIO_UNIMAP:
-		return do_unimap_ioctl(cmd, up, perm, vc);
+		return do_unimap_ioctl(cmd, u, perm, vc);
 
 	case VT_LOCKSWITCH:
 		if (!capable(CAP_SYS_TTY_CONFIG))
--- linux-2.6.18-rc2-orig/fs/select.c	2006-07-18 18:46:59.000000000 +0200
+++ linux-2.6.18-rc2/fs/select.c	2006-07-18 21:23:01.000000000 +0200
@@ -524,17 +524,17 @@ asmlinkage long sys_pselect6(int n, fd_s
 	fd_set __user *exp, struct timespec __user *tsp, void __user *sig)
 {
 	size_t sigsetsize = 0;
-	sigset_t __user *up = NULL;
+	sigset_t __user *u = NULL;
 
 	if (sig) {
 		if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t))
-		    || __get_user(up, (sigset_t __user * __user *)sig)
+		    || __get_user(u, (sigset_t __user * __user *)sig)
 		    || __get_user(sigsetsize,
 				(size_t __user *)(sig+sizeof(void *))))
 			return -EFAULT;
 	}
 
-	return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize);
+	return sys_pselect7(n, inp, outp, exp, tsp, u, sigsetsize);
 }
 #endif /* TIF_RESTORE_SIGMASK */
 
--- linux-2.6.18-rc2-orig/kernel/user.c	2006-07-18 18:47:16.000000000 +0200
+++ linux-2.6.18-rc2/kernel/user.c	2006-07-19 00:05:58.000000000 +0200
@@ -56,14 +56,14 @@ struct user_struct root_user = {
 /*
  * These routines must be called with the uidhash spinlock held!
  */
-static inline void uid_hash_insert(struct user_struct *up, struct list_head *hashent)
+static inline void uid_hash_insert(struct user_struct *u, struct list_head *hashent)
 {
-	list_add(&up->uidhash_list, hashent);
+	list_add(&u->uidhash_list, hashent);
 }
 
-static inline void uid_hash_remove(struct user_struct *up)
+static inline void uid_hash_remove(struct user_struct *u)
 {
-	list_del(&up->uidhash_list);
+	list_del(&u->uidhash_list);
 }
 
 static inline struct user_struct *uid_hash_find(uid_t uid, struct list_head *hashent)
@@ -101,20 +101,20 @@ struct user_struct *find_user(uid_t uid)
 	return ret;
 }
 
-void free_uid(struct user_struct *up)
+void free_uid(struct user_struct *u)
 {
 	unsigned long flags;
 
-	if (!up)
+	if (!u)
 		return;
 
 	local_irq_save(flags);
-	if (atomic_dec_and_lock(&up->__count, &uidhash_lock)) {
-		uid_hash_remove(up);
+	if (atomic_dec_and_lock(&u->__count, &uidhash_lock)) {
+		uid_hash_remove(u);
 		spin_unlock_irqrestore(&uidhash_lock, flags);
-		key_put(up->uid_keyring);
-		key_put(up->session_keyring);
-		kmem_cache_free(uid_cachep, up);
+		key_put(u->uid_keyring);
+		key_put(u->session_keyring);
+		kmem_cache_free(uid_cachep, u);
 	} else {
 		local_irq_restore(flags);
 	}
@@ -123,13 +123,13 @@ void free_uid(struct user_struct *up)
 struct user_struct * alloc_uid(uid_t uid)
 {
 	struct list_head *hashent = uidhashentry(uid);
-	struct user_struct *up;
+	struct user_struct *u;
 
 	spin_lock_irq(&uidhash_lock);
-	up = uid_hash_find(uid, hashent);
+	u = uid_hash_find(uid, hashent);
 	spin_unlock_irq(&uidhash_lock);
 
-	if (!up) {
+	if (!u) {
 		struct user_struct *new;
 
 		new = kmem_cache_alloc(uid_cachep, SLAB_KERNEL);
@@ -158,19 +158,19 @@ struct user_struct * alloc_uid(uid_t uid
 		 * on adding the same user already..
 		 */
 		spin_lock_irq(&uidhash_lock);
-		up = uid_hash_find(uid, hashent);
-		if (up) {
+		u = uid_hash_find(uid, hashent);
+		if (u) {
 			key_put(new->uid_keyring);
 			key_put(new->session_keyring);
 			kmem_cache_free(uid_cachep, new);
 		} else {
 			uid_hash_insert(new, hashent);
-			up = new;
+			u = new;
 		}
 		spin_unlock_irq(&uidhash_lock);
 
 	}
-	return up;
+	return u;
 }
 
 void switch_uid(struct user_struct *new_user)



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux