Message ID | c8ccba0bbcb9147fb220fd18b3b5e1e951b6d5fd.1591960478.git.suse-tux@gmx.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | keys: Do not check the retval of commit_creds in join_session_keyring | expand |
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
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
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
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; }
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(-) -- 2.26.2