From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kernel@vger.kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH] kobject: return -ENOSPC when add_uevent_var() fails
Date: Mon, 10 Jun 2019 19:45:38 +0200 [thread overview]
Message-ID: <20190610174538.GA10617@kroah.com> (raw)
In-Reply-To: <20190604174412.13324-1-yamada.masahiro@socionext.com>
On Wed, Jun 05, 2019 at 02:44:12AM +0900, Masahiro Yamada wrote:
> This function never attempts to allocate memory, so returning -ENOMEM
> looks weird to me. The reason of the failure is there is no more space
> in the given kobj_uevent_env structure.
>
> No caller of this function relies on this functing returning a specific
> error code, so just change it to return -ENOSPC. The intended change,
> if any, is the error number displayed in log messages.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> lib/kobject_uevent.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
> index 7998affa45d4..5ffd44bf4aad 100644
> --- a/lib/kobject_uevent.c
> +++ b/lib/kobject_uevent.c
> @@ -647,7 +647,7 @@ EXPORT_SYMBOL_GPL(kobject_uevent);
> * @env: environment buffer structure
> * @format: printf format for the key=value pair
> *
> - * Returns 0 if environment variable was added successfully or -ENOMEM
> + * Returns 0 if environment variable was added successfully or -ENOSPC
> * if no space was available.
> */
> int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
> @@ -657,7 +657,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
>
> if (env->envp_idx >= ARRAY_SIZE(env->envp)) {
> WARN(1, KERN_ERR "add_uevent_var: too many keys\n");
> - return -ENOMEM;
> + return -ENOSPC;
As Rafael says, changing this for no good reason is not a good idea,
sorry. Let's live with it as-is unless you can show some place where
this specific error value is causing problems.
thanks,
greg k-h
next prev parent reply other threads:[~2019-06-10 17:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 17:44 [PATCH] kobject: return -ENOSPC when add_uevent_var() fails Masahiro Yamada
2019-06-04 20:50 ` Rafael J. Wysocki
2019-06-07 11:53 ` Masahiro Yamada
2019-06-07 12:26 ` Rafael J. Wysocki
2019-06-10 17:45 ` Greg Kroah-Hartman [this message]
2019-06-10 21:09 ` Masahiro Yamada
2019-06-19 17:25 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190610174538.GA10617@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox