Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1296379
| From | Al Viro <viro@ZenIV.linux.org.uk> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [POC][PATCH 16/83] user_namespace: get rid of pointless casts |
| Date | 2015-12-22 01:10 +0100 |
| Message-ID | <qIiGF-50N-73@gated-at.bofh.it> (permalink) |
| References | <qIing-4Eb-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- kernel/user_namespace.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index b01948c..badce97 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -602,8 +602,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, struct uid_gid_map new_map; unsigned idx; struct uid_gid_extent *extent = NULL; - unsigned long page = 0; - char *kbuf, *pos, *next_line; + char *kbuf = NULL, *pos, *next_line; ssize_t ret = -EINVAL; /* @@ -640,9 +639,8 @@ static ssize_t map_write(struct file *file, const char __user *buf, /* Get a buffer */ ret = -ENOMEM; - page = __get_free_page(GFP_TEMPORARY); - kbuf = (char *) page; - if (!page) + kbuf = (char *)__get_free_page(GFP_TEMPORARY); + if (!kbuf) goto out; /* Only allow < page size writes at the beginning of the file */ @@ -756,8 +754,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, ret = count; out: mutex_unlock(&userns_state_mutex); - if (page) - free_page((void *)page); + free_page(kbuf); return ret; } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[POC][PATCH 16/83] user_namespace: get rid of pointless casts Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-22 01:10 +0100
csiph-web