linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/6] PNP: Improve a size determination in pnp_clone_dependent_set()
Date: Mon, 15 May 2017 21:16:04 +0200	[thread overview]
Message-ID: <2a61f08a-54f2-c8c9-1aa0-4cc9b51715db@users.sourceforge.net> (raw)
In-Reply-To: <94f6ec12-0092-e1e6-3fb1-81f9630eae1f@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 19:52:26 +0200

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>
---
 drivers/pnp/quirks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index d28e3ab9479c..215a50723243 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -155,6 +155,5 @@ static struct pnp_option *pnp_clone_dependent_set(struct pnp_dev *dev,
 	list_for_each_entry(option, &dev->options, list) {
 		if (pnp_option_is_dependent(option) &&
 		    pnp_option_set(option) == set) {
-			new_option = kmalloc(sizeof(struct pnp_option),
-					     GFP_KERNEL);
+			new_option = kmalloc(sizeof(*new_option), GFP_KERNEL);
 			if (!new_option) {
-- 
2.13.0

  parent reply	other threads:[~2017-05-15 19:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
2017-05-15 19:12 ` [PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc() SF Markus Elfring
2017-05-15 19:14 ` [PATCH 2/6] PNP: Improve a size determination in pnp_alloc_dev() SF Markus Elfring
2017-05-15 19:16 ` SF Markus Elfring [this message]
2017-05-15 19:18 ` [PATCH 4/6] PNP: Delete an error message for a failed memory allocation in pnp_clone_dependent_set() SF Markus Elfring
2017-05-15 19:20 ` [PATCH 5/6] PNP: Improve a size determination in quirk_awe32_add_ports() SF Markus Elfring
2017-05-15 19:22 ` [PATCH 6/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-27 19:08 ` [PATCH 0/6] PNP: Adjustments for four function implementations Andy Shevchenko
2017-12-18 18:21 ` 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=2a61f08a-54f2-c8c9-1aa0-4cc9b51715db@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.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;
as well as URLs for NNTP newsgroup(s).