* [patch] KEYS: Propagate error code instead of returning -EINVAL @ 2010-06-03 19:09 Dan Carpenter 2010-06-04 10:08 ` David Howells 2010-06-06 23:23 ` [patch] KEYS: Propagate error code instead of returning James Morris 0 siblings, 2 replies; 3+ messages in thread From: Dan Carpenter @ 2010-06-03 19:09 UTC (permalink / raw) To: kernel-janitors This is from a Smatch check I'm writing. strncpy_from_user() returns -EFAULT on error so the first change just silences a warning but doesn't change how the code works. The other change is a bug fix because install_thread_keyring_to_cred() can return a variety of errors such as -EINVAL, -EEXIST, -ENOMEM or -EKEYREVOKED. Signed-off-by: Dan Carpenter <error27@gmail.com> diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 13074b4..6261745 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -33,7 +33,7 @@ static int key_get_type_from_user(char *type, ret = strncpy_from_user(type, _type, len); if (ret < 0) - return -EFAULT; + return ret; if (ret = 0 || ret >= len) return -EINVAL; @@ -1080,7 +1080,7 @@ set: return old_setting; error: abort_creds(new); - return -EINVAL; + return ret; } /* end keyctl_set_reqkey_keyring() */ ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] KEYS: Propagate error code instead of returning -EINVAL 2010-06-03 19:09 [patch] KEYS: Propagate error code instead of returning -EINVAL Dan Carpenter @ 2010-06-04 10:08 ` David Howells 2010-06-06 23:23 ` [patch] KEYS: Propagate error code instead of returning James Morris 1 sibling, 0 replies; 3+ messages in thread From: David Howells @ 2010-06-04 10:08 UTC (permalink / raw) To: kernel-janitors Dan Carpenter <error27@gmail.com> wrote: > This is from a Smatch check I'm writing. > > strncpy_from_user() returns -EFAULT on error so the first change just > silences a warning but doesn't change how the code works. > > The other change is a bug fix because install_thread_keyring_to_cred() > can return a variety of errors such as -EINVAL, -EEXIST, -ENOMEM or > -EKEYREVOKED. > > Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: David Howells <dhowells@redhat.com> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] KEYS: Propagate error code instead of returning 2010-06-03 19:09 [patch] KEYS: Propagate error code instead of returning -EINVAL Dan Carpenter 2010-06-04 10:08 ` David Howells @ 2010-06-06 23:23 ` James Morris 1 sibling, 0 replies; 3+ messages in thread From: James Morris @ 2010-06-06 23:23 UTC (permalink / raw) To: kernel-janitors On Thu, 3 Jun 2010, Dan Carpenter wrote: > This is from a Smatch check I'm writing. > > strncpy_from_user() returns -EFAULT on error so the first change just > silences a warning but doesn't change how the code works. > > The other change is a bug fix because install_thread_keyring_to_cred() > can return a variety of errors such as -EINVAL, -EEXIST, -ENOMEM or > -EKEYREVOKED. > > Signed-off-by: Dan Carpenter <error27@gmail.com> Applied to git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next -- James Morris <jmorris@namei.org> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-06 23:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-06-03 19:09 [patch] KEYS: Propagate error code instead of returning -EINVAL Dan Carpenter 2010-06-04 10:08 ` David Howells 2010-06-06 23:23 ` [patch] KEYS: Propagate error code instead of returning James Morris
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox