mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Anton Vasilyev <vasilyev@ispras.ru>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Kosina <jkosina@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] misc/ibmasm: Improve a size determination in ibmasm_init_one()
Date: Mon, 8 Jan 2018 14:09:32 +0100	[thread overview]
Message-ID: <bda74202-f96e-9117-87cf-75f080d87123@users.sourceforge.net> (raw)
In-Reply-To: <842e4179-dbac-cd43-e320-c5009d896a28@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 Jan 2018 13:43:20 +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.

This issue was detected by using the Coccinelle software.

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

diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index d22b3c428ca9..894397b1ee51 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -78,7 +78,7 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* vnc client won't work without bus-mastering */
 	pci_set_master(pdev);
 
-	sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL);
+	sp = kzalloc(sizeof(*sp), GFP_KERNEL);
 	if (sp == NULL) {
 		result = -ENOMEM;
 		goto error_kmalloc;
-- 
2.15.1

  parent reply	other threads:[~2018-01-08 13:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 13:07 [PATCH 0/3] misc-IBM ASM SP: Adjustments for ibmasm_init_one() SF Markus Elfring
2018-01-08 13:08 ` [PATCH 1/3] misc/ibmasm: Delete an error message for a failed memory allocation in ibmasm_init_one() SF Markus Elfring
2018-01-08 13:09 ` SF Markus Elfring [this message]
2018-01-08 13:10 ` [PATCH 3/3] misc/ibmasm: Adjust two function calls together with a variable assignment SF 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=bda74202-f96e-9117-87cf-75f080d87123@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jkosina@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vasilyev@ispras.ru \
    /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

Powered by JetHome