Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1296379 > unrolled thread

[POC][PATCH 16/83] user_namespace: get rid of pointless casts

Started byAl Viro <viro@ZenIV.linux.org.uk>
First post2015-12-22 01:10 +0100
Last post2015-12-22 01:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [POC][PATCH 16/83] user_namespace: get rid of pointless casts Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-22 01:10 +0100

#1296379 — [POC][PATCH 16/83] user_namespace: get rid of pointless casts

FromAl Viro <viro@ZenIV.linux.org.uk>
Date2015-12-22 01:10 +0100
Subject[POC][PATCH 16/83] user_namespace: get rid of pointless casts
Message-ID<qIiGF-50N-73@gated-at.bofh.it>
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/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web