From: Markus Elfring <Markus.Elfring@web.de>
To: kernel-janitors@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, cocci@inria.fr
Subject: [PATCH 1/3] kobject: Add a jump label in kobject_uevent_env()
Date: Tue, 19 Dec 2023 16:32:48 +0100 [thread overview]
Message-ID: <6d7d0b33-6c9e-4941-af5f-678137d2a00e@web.de> (raw)
In-Reply-To: <e0543d9d-a02a-4c9c-b341-36771cfb5353@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 19 Dec 2023 14:16:35 +0100
Use another label so that a call of the function “kfree” can be avoided
after a failed call of the function “kobject_get_path”.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
lib/kobject_uevent.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index fb9a2f06dd1e..811e579ed89d 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -529,7 +529,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
devpath = kobject_get_path(kobj, GFP_KERNEL);
if (!devpath) {
retval = -ENOENT;
- goto exit;
+ goto free_env;
}
/* default keys */
@@ -623,6 +623,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
exit:
kfree(devpath);
+free_env:
kfree(env);
return retval;
}
--
2.43.0
next prev parent reply other threads:[~2023-12-19 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 15:30 [PATCH 0/3] kobject: Adjustments for kobject_uevent_env() Markus Elfring
2023-12-19 15:32 ` Markus Elfring [this message]
2023-12-19 15:34 ` [PATCH 2/3] kobject: Improve a size determination in kobject_uevent_env() Markus Elfring
2023-12-19 15:40 ` Greg Kroah-Hartman
2023-12-19 15:36 ` [PATCH 3/3] kobject: Delete an unnecessary variable initialisation " Markus Elfring
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=6d7d0b33-6c9e-4941-af5f-678137d2a00e@web.de \
--to=markus.elfring@web.de \
--cc=akpm@linux-foundation.org \
--cc=cocci@inria.fr \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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