Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1567286

[PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add()
Date 2017-01-26 11:30 +0100
Message-ID <t3Ptw-68L-23@gated-at.bofh.it> (permalink)
References <t3PjP-65h-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] GTP: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 11:20 +0100
  [PATCH 1/5] gtp: Use kmalloc_array() in gtp_hashtable_new() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 11:20 +0100
  [PATCH 4/5] gtp: Rename jump labels in gtp_encap_enable() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 11:30 +0100
  [PATCH 5/5] gtp: Rename jump labels in gtp_hashtable_new() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 11:30 +0100
  [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 11:30 +0100
    Re: [PATCH 2/5] gtp: Improve another size determination in ipv4_pdp_add() Alexey Dobriyan <adobriyan@gmail.com> - 2017-01-26 14:20 +0100
  [PATCH 3/5] gtp: Adjust 12 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-26 11:30 +0100
  Re: [PATCH 0/5] GTP: Fine-tuning for some function implementations Andreas Schultz <aschultz@tpip.net> - 2017-01-26 12:30 +0100

csiph-web