linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] userns: Fix a kernel coding style issue
@ 2020-07-27 11:33 Yadav Lamichhane
  2020-07-27 13:39 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Yadav Lamichhane @ 2020-07-27 11:33 UTC (permalink / raw)
  To: christian.brauner; +Cc: serge, linux-kernel, Yadav Lamichhane

fix a brace around if-else statement and for loop.

Signed-off-by: Yadav Lamichhane <tuxomega1@gmail.com>
---
 kernel/user_namespace.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 87804e0371fe..7703753cac97 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -118,9 +118,8 @@ int create_user_ns(struct cred *new)
 	ns->owner = owner;
 	ns->group = group;
 	INIT_WORK(&ns->work, free_user_ns);
-	for (i = 0; i < UCOUNT_COUNTS; i++) {
+	for (i = 0; i < UCOUNT_COUNTS; i++)
 		ns->ucount_max[i] = INT_MAX;
-	}
 	ns->ucounts = ucounts;

 	/* Inherit USERNS_SETGROUPS_ALLOWED from our parent */
@@ -1156,12 +1155,10 @@ ssize_t proc_setgroups_write(struct file *file, const char __user *buf,
 	if (strncmp(pos, "allow", 5) == 0) {
 		pos += 5;
 		setgroups_allowed = true;
-	}
-	else if (strncmp(pos, "deny", 4) == 0) {
+	} else if (strncmp(pos, "deny", 4) == 0) {
 		pos += 4;
 		setgroups_allowed = false;
-	}
-	else
+	} else
 		goto out;

 	/* Verify there is not trailing junk on the line */
--
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] userns: Fix a kernel coding style issue
  2020-07-27 11:33 [PATCH] userns: Fix a kernel coding style issue Yadav Lamichhane
@ 2020-07-27 13:39 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2020-07-27 13:39 UTC (permalink / raw)
  To: Yadav Lamichhane; +Cc: serge, linux-kernel

On Mon, Jul 27, 2020 at 05:18:23PM +0545, Yadav Lamichhane wrote:
> fix a brace around if-else statement and for loop.
> 
> Signed-off-by: Yadav Lamichhane <tuxomega1@gmail.com>
> ---
>  kernel/user_namespace.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
> index 87804e0371fe..7703753cac97 100644
> --- a/kernel/user_namespace.c
> +++ b/kernel/user_namespace.c
> @@ -118,9 +118,8 @@ int create_user_ns(struct cred *new)
>  	ns->owner = owner;
>  	ns->group = group;
>  	INIT_WORK(&ns->work, free_user_ns);
> -	for (i = 0; i < UCOUNT_COUNTS; i++) {
> +	for (i = 0; i < UCOUNT_COUNTS; i++)
>  		ns->ucount_max[i] = INT_MAX;
> -	}
>  	ns->ucounts = ucounts;
> 
>  	/* Inherit USERNS_SETGROUPS_ALLOWED from our parent */
> @@ -1156,12 +1155,10 @@ ssize_t proc_setgroups_write(struct file *file, const char __user *buf,
>  	if (strncmp(pos, "allow", 5) == 0) {
>  		pos += 5;
>  		setgroups_allowed = true;
> -	}
> -	else if (strncmp(pos, "deny", 4) == 0) {
> +	} else if (strncmp(pos, "deny", 4) == 0) {
>  		pos += 4;
>  		setgroups_allowed = false;
> -	}
> -	else
> +	} else
>  		goto out;

Kernel coding style would mandate that the else be enclosed in {} as well.

Christian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-27 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 11:33 [PATCH] userns: Fix a kernel coding style issue Yadav Lamichhane
2020-07-27 13:39 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).