public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
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 2/3] kobject: Improve a size determination in kobject_uevent_env()
Date: Tue, 19 Dec 2023 16:34:19 +0100	[thread overview]
Message-ID: <f007f92c-a355-4bb9-a715-aa42ee6c647b@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 16:00:22 +0100

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 lib/kobject_uevent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 811e579ed89d..a9b1bc02f65c 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -521,7 +521,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 	}

 	/* environment buffer */
-	env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
+	env = kzalloc(sizeof(*env), GFP_KERNEL);
 	if (!env)
 		return -ENOMEM;

--
2.43.0


  parent reply	other threads:[~2023-12-19 15:39 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 ` [PATCH 1/3] kobject: Add a jump label in kobject_uevent_env() Markus Elfring
2023-12-19 15:34 ` Markus Elfring [this message]
2023-12-19 15:40   ` [PATCH 2/3] kobject: Improve a size determination " 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=f007f92c-a355-4bb9-a715-aa42ee6c647b@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