linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: netdev@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Harald Welte <laforge@gnumonks.org>,
	Johannes Berg <johannes.berg@intel.com>,
	Pablo Neira <pablo@netfilter.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add()
Date: Thu, 26 Jan 2017 11:18:09 +0100	[thread overview]
Message-ID: <91f31650-3052-507c-8006-96874107f981@users.sourceforge.net> (raw)
In-Reply-To: <698070a4-e08e-78e5-0214-df69783cce22@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 25 Jan 2017 22:24:08 +0100

Replace the specification of a data type 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/net/gtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 5d0d520ae40f..f0c123101aa9 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -956,7 +956,7 @@ static int ipv4_pdp_add(struct net_device *dev, struct genl_info *info)
 
 	}
 
-	pctx = kmalloc(sizeof(struct pdp_ctx), GFP_KERNEL);
+	pctx = kmalloc(sizeof(*pctx), GFP_KERNEL);
 	if (pctx == NULL)
 		return -ENOMEM;
 
-- 
2.11.0

  parent reply	other threads:[~2017-01-26 10:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 10:15 [PATCH 0/5] GTP: Fine-tuning for some function implementations SF Markus Elfring
2017-01-26 10:17 ` [PATCH 1/5] gtp: Use kmalloc_array() in gtp_hashtable_new() SF Markus Elfring
2017-01-26 10:18 ` SF Markus Elfring [this message]
2017-01-26 13:11   ` [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add() Alexey Dobriyan
2017-01-26 10:19 ` [PATCH 3/5] gtp: Adjust 12 checks for null pointers SF Markus Elfring
2017-01-26 10:20 ` [PATCH 4/5] gtp: Rename jump labels in gtp_encap_enable() SF Markus Elfring
2017-01-26 10:22 ` [PATCH 5/5] gtp: Rename jump labels in gtp_hashtable_new() SF Markus Elfring
2017-01-26 11:14 ` [PATCH 0/5] GTP: Fine-tuning for some function implementations Andreas Schultz

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=91f31650-3052-507c-8006-96874107f981@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=johannes.berg@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=laforge@gnumonks.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.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;
as well as URLs for NNTP newsgroup(s).