keyrings.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring
@ 2019-09-10 14:07 Marcus Huewe
  2019-10-14 13:06 ` Marcus Hüwe
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Marcus Huewe @ 2019-09-10 14:07 UTC (permalink / raw)
  To: keyrings

Do not check the return value of the commit_creds call in
join_session_keyring in order to make the code more concise.
Since commit_creds always returns 0, the if-statement is not needed
and the session keyring's serial can be directly assigned to the
"ret" variable.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
---
 security/keys/process_keys.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 09541de31f2f..e7cd1ff84709 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -840,7 +840,7 @@ long join_session_keyring(const char *name)
 	const struct cred *old;
 	struct cred *new;
 	struct key *keyring;
-	long ret, serial;
+	long ret;

 	new = prepare_creds();
 	if (!new)
@@ -853,10 +853,8 @@ long join_session_keyring(const char *name)
 		if (ret < 0)
 			goto error;

-		serial = new->session_keyring->serial;
-		ret = commit_creds(new);
-		if (ret == 0)
-			ret = serial;
+		ret = new->session_keyring->serial;
+		commit_creds(new);
 		goto okay;
 	}

--
2.22.0

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

* Re: [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring
  2019-09-10 14:07 [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring Marcus Huewe
@ 2019-10-14 13:06 ` Marcus Hüwe
  2020-06-12 11:25 ` Marcus Huewe
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Marcus Hüwe @ 2019-10-14 13:06 UTC (permalink / raw)
  To: keyrings

Just a gentle ping - any news on this?:)

On 2019-09-10 16:07:59 +0200, Marcus Huewe wrote:
> Do not check the return value of the commit_creds call in
> join_session_keyring in order to make the code more concise.
> Since commit_creds always returns 0, the if-statement is not needed
> and the session keyring's serial can be directly assigned to the
> "ret" variable.
>
> Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
> ---
>  security/keys/process_keys.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
> index 09541de31f2f..e7cd1ff84709 100644
> --- a/security/keys/process_keys.c
> +++ b/security/keys/process_keys.c
> @@ -840,7 +840,7 @@ long join_session_keyring(const char *name)
>  	const struct cred *old;
>  	struct cred *new;
>  	struct key *keyring;
> -	long ret, serial;
> +	long ret;
>
>  	new = prepare_creds();
>  	if (!new)
> @@ -853,10 +853,8 @@ long join_session_keyring(const char *name)
>  		if (ret < 0)
>  			goto error;
>
> -		serial = new->session_keyring->serial;
> -		ret = commit_creds(new);
> -		if (ret == 0)
> -			ret = serial;
> +		ret = new->session_keyring->serial;
> +		commit_creds(new);
>  		goto okay;
>  	}
>
> --
> 2.22.0
>

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

* [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring
  2019-09-10 14:07 [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring Marcus Huewe
  2019-10-14 13:06 ` Marcus Hüwe
@ 2020-06-12 11:25 ` Marcus Huewe
  2020-06-17  1:46 ` Jarkko Sakkinen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Marcus Huewe @ 2020-06-12 11:25 UTC (permalink / raw)
  To: dhowells, jarkko.sakkinen; +Cc: keyrings

Do not check the return value of the commit_creds call in
join_session_keyring in order to make the code more concise.
Since commit_creds always returns 0, the if-statement is not needed
and the session keyring's serial can be directly assigned to the
"ret" variable.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
---
 security/keys/process_keys.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 09541de31f2f..e7cd1ff84709 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -840,7 +840,7 @@ long join_session_keyring(const char *name)
 	const struct cred *old;
 	struct cred *new;
 	struct key *keyring;
-	long ret, serial;
+	long ret;

 	new = prepare_creds();
 	if (!new)
@@ -853,10 +853,8 @@ long join_session_keyring(const char *name)
 		if (ret < 0)
 			goto error;

-		serial = new->session_keyring->serial;
-		ret = commit_creds(new);
-		if (ret == 0)
-			ret = serial;
+		ret = new->session_keyring->serial;
+		commit_creds(new);
 		goto okay;
 	}

--
2.26.2

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

* Re: [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring
  2019-09-10 14:07 [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring Marcus Huewe
  2019-10-14 13:06 ` Marcus Hüwe
  2020-06-12 11:25 ` Marcus Huewe
@ 2020-06-17  1:46 ` Jarkko Sakkinen
  2020-07-28 11:06 ` Marcus Hüwe
  2020-08-17 21:17 ` Jarkko Sakkinen
  4 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-06-17  1:46 UTC (permalink / raw)
  To: keyrings

On Fri, Jun 12, 2020 at 01:25:33PM +0200, Marcus Huewe wrote:
> Do not check the return value of the commit_creds call in
> join_session_keyring in order to make the code more concise.
> Since commit_creds always returns 0, the if-statement is not needed
> and the session keyring's serial can be directly assigned to the
> "ret" variable.
> 
> Signed-off-by: Marcus Huewe <suse-tux@gmx.de>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

David, can you pick this up to your tree (give that a generic
keyring change)?

/Jarkko

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

* Re: [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring
  2019-09-10 14:07 [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring Marcus Huewe
                   ` (2 preceding siblings ...)
  2020-06-17  1:46 ` Jarkko Sakkinen
@ 2020-07-28 11:06 ` Marcus Hüwe
  2020-08-17 21:17 ` Jarkko Sakkinen
  4 siblings, 0 replies; 6+ messages in thread
From: Marcus Hüwe @ 2020-07-28 11:06 UTC (permalink / raw)
  To: keyrings

On 2020-06-17 04:46:24 +0300, Jarkko Sakkinen wrote:
> On Fri, Jun 12, 2020 at 01:25:33PM +0200, Marcus Huewe wrote:
> > Do not check the return value of the commit_creds call in
> > join_session_keyring in order to make the code more concise.
> > Since commit_creds always returns 0, the if-statement is not needed
> > and the session keyring's serial can be directly assigned to the
> > "ret" variable.
> >
> > Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
>
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>
> David, can you pick this up to your tree (give that a generic
> keyring change)?
>
Just a gentle ping - any news on this?:)

(I'm perfectly fine if you don't want to take it... (since it is
just a minor cleanup and no bugfix))


Marcus

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

* Re: [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring
  2019-09-10 14:07 [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring Marcus Huewe
                   ` (3 preceding siblings ...)
  2020-07-28 11:06 ` Marcus Hüwe
@ 2020-08-17 21:17 ` Jarkko Sakkinen
  4 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-08-17 21:17 UTC (permalink / raw)
  To: keyrings

On Tue, Jul 28, 2020 at 01:06:35PM +0200, Marcus Hüwe wrote:
> On 2020-06-17 04:46:24 +0300, Jarkko Sakkinen wrote:
> > On Fri, Jun 12, 2020 at 01:25:33PM +0200, Marcus Huewe wrote:
> > > Do not check the return value of the commit_creds call in
> > > join_session_keyring in order to make the code more concise.
> > > Since commit_creds always returns 0, the if-statement is not needed
> > > and the session keyring's serial can be directly assigned to the
> > > "ret" variable.
> > >
> > > Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
> >
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> >
> > David, can you pick this up to your tree (give that a generic
> > keyring change)?
> >
> Just a gentle ping - any news on this?:)
> 
> (I'm perfectly fine if you don't want to take it... (since it is
> just a minor cleanup and no bugfix))
> 
> 
> Marcus

I just came from two weeks of vacation and one week of network
connectivity issues (could not connect to the company VPN).

I still think that David should at least ack this.

/Jarkko

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

end of thread, other threads:[~2020-08-17 21:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 14:07 [PATCH] keys: Do not check the retval of commit_creds in join_session_keyring Marcus Huewe
2019-10-14 13:06 ` Marcus Hüwe
2020-06-12 11:25 ` Marcus Huewe
2020-06-17  1:46 ` Jarkko Sakkinen
2020-07-28 11:06 ` Marcus Hüwe
2020-08-17 21:17 ` Jarkko Sakkinen

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).