From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Jesper Juhl <jesper.juhl@gmail.com>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 04/12] making the kernel -Wshadow clean - warnings related to 'up'
Date: Sun, 30 Jul 2006 18:38:03 +0200 [thread overview]
Message-ID: <200607301838.03869.jesper.juhl@gmail.com> (raw)
In-Reply-To: <200607301830.01659.jesper.juhl@gmail.com>
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 <jesper.juhl@gmail.com>
---
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)
next prev parent reply other threads:[~2006-07-30 16:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-30 16:30 [PATCH 00/12] making the kernel -Wshadow clean - The initial step Jesper Juhl
2006-07-30 16:35 ` [PATCH 01/12] making the kernel -Wshadow clean - fix mconf Jesper Juhl
2006-07-30 18:34 ` Paul Jackson
2006-07-30 18:48 ` Jesper Juhl
2006-07-30 19:06 ` Andrew Morton
2006-07-30 19:17 ` Jesper Juhl
2006-07-30 19:51 ` Andrew Morton
2006-07-30 19:57 ` Arjan van de Ven
2006-07-30 20:03 ` Jesper Juhl
2006-07-30 19:32 ` Paul Jackson
2006-07-30 23:41 ` Arnd Bergmann
2006-07-31 15:41 ` Horst H. von Brand
2006-07-31 16:04 ` H. Peter Anvin
2006-07-30 16:36 ` [PATCH 02/12] making the kernel -Wshadow clean - fix lxdialog Jesper Juhl
2006-07-30 16:37 ` [PATCH 03/12] making the kernel -Wshadow clean - fix jiffies.h Jesper Juhl
2006-07-30 16:38 ` Jesper Juhl [this message]
2006-07-30 16:38 ` [PATCH 05/12] making the kernel -Wshadow clean - warnings related to wbc and map_bh Jesper Juhl
2006-07-30 16:39 ` [PATCH 06/12] making the kernel -Wshadow clean - fix checksum Jesper Juhl
2006-07-30 16:40 ` [PATCH 07/12] making the kernel -Wshadow clean - fix vgacon Jesper Juhl
2006-07-30 16:41 ` [PATCH 08/12] making the kernel -Wshadow clean - fix keyboard.c Jesper Juhl
2006-07-30 16:42 ` [PATCH 09/12] making the kernel -Wshadow clean - neighbour.h and 'proc_handler' Jesper Juhl
2006-07-30 16:42 ` [PATCH 10/12] making the kernel -Wshadow clean - mm/truncate.c Jesper Juhl
2006-07-30 16:43 ` [PATCH 11/12] making the kernel -Wshadow clean - USB & completion Jesper Juhl
2006-07-30 16:44 ` [PATCH 12/12] making the kernel -Wshadow clean - 'irq' shadows local and global Jesper Juhl
2006-07-30 16:54 ` [PATCH 00/12] making the kernel -Wshadow clean - The initial step Krzysztof Halasa
2006-07-30 17:14 ` Jesper Juhl
2006-07-30 17:27 ` Krzysztof Halasa
2006-07-30 18:29 ` Andrew Morton
2006-07-30 23:36 ` Arnd Bergmann
2006-08-01 6:17 ` Jan Engelhardt
2006-07-30 19:24 ` Jesper Juhl
2006-07-30 20:09 ` Jan-Benedict Glaw
2006-07-30 19:29 ` Sam Ravnborg
2006-07-30 19:39 ` Jesper Juhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200607301838.03869.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.