linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Cliff Whickman <cpw@sgi.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Robin Holt <robinmholt@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/4] sgi-xpnet: Improve a size determination in xpnet_dev_hard_start_xmit()
Date: Wed, 10 Jan 2018 11:23:40 +0100	[thread overview]
Message-ID: <41b59f3b-00e4-13e2-2952-50781804b52f@users.sourceforge.net> (raw)
In-Reply-To: <f1f2d65f-940f-f835-db4e-878e911f6011@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 10:48:25 +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/sgi-xp/xpnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index e13aa6c74028..a4415616c03c 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -427,7 +427,7 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * xpc_send_notifies are relying on this skb.  When none
 	 * remain, release the skb.
 	 */
-	queued_msg = kmalloc(sizeof(struct xpnet_pending_msg), GFP_ATOMIC);
+	queued_msg = kmalloc(sizeof(*queued_msg), GFP_ATOMIC);
 	if (queued_msg == NULL) {
 		dev->stats.tx_errors++;
 		dev_kfree_skb(skb);
-- 
2.15.1

  parent reply	other threads:[~2018-01-10 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 10:20 [PATCH 0/4] SGI-XPNET: Adjustments for five function implementations SF Markus Elfring
2018-01-10 10:22 ` [PATCH 1/4] sgi-xpnet: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-01-10 10:23 ` SF Markus Elfring [this message]
2018-01-10 10:24 ` [PATCH 3/4] sgi-xpnet: Use common code in xpnet_dev_hard_start_xmit() SF Markus Elfring
2018-01-10 10:25 ` [PATCH 4/4] sgi-xpnet: Adjust five checks for null pointers 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=41b59f3b-00e4-13e2-2952-50781804b52f@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=arnd@arndb.de \
    --cc=cpw@sgi.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robinmholt@gmail.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).