mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: netdev@vger.kernel.org,
	Augusto Mecking Caringi <augustocaringi@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jarod Wilson <jarod@redhat.com>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	Kees Cook <keescook@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/5] atm: Improve a size determination in four functions
Date: Sun, 21 May 2017 22:14:11 +0200	[thread overview]
Message-ID: <83404a6d-c7bc-7b06-fa93-0971b1116b9d@users.sourceforge.net> (raw)
In-Reply-To: <49543220-93e4-781c-877b-381277837152@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 21 May 2017 21:20:44 +0200

Replace the specification of four data structures by pointer dereferences
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>
---
 net/atm/lec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 09cfe87f0a44..6ad3ca625a44 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -518,5 +518,5 @@ send_to_lecd(struct lec_priv *priv, atmlec_msg_type type,
 		return -1;
 	skb->len = sizeof(struct atmlec_msg);
 	mesg = (struct atmlec_msg *)skb->data;
-	memset(mesg, 0, sizeof(struct atmlec_msg));
+	memset(mesg, 0, sizeof(*mesg));
 	mesg->type = type;
@@ -690,5 +690,5 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
 	if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF ||
 	    !dev_lec[ioc_data.dev_num])
 		return -EINVAL;
-	vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
+	vpriv = kmalloc(sizeof(*vpriv), GFP_KERNEL);
 	if (!vpriv)
@@ -1552,5 +1552,5 @@ static struct lec_arp_table *make_entry(struct lec_priv *priv,
 {
 	struct lec_arp_table *to_return;
 
-	to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
+	to_return = kzalloc(sizeof(*to_return), GFP_ATOMIC);
 	if (!to_return) {
@@ -2156,5 +2156,5 @@ static int lec_mcast_make(struct lec_priv *priv, struct atm_vcc *vcc)
 	struct lec_vcc_priv *vpriv;
 	int err = 0;
 
-	vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
+	vpriv = kmalloc(sizeof(*vpriv), GFP_KERNEL);
 	if (!vpriv)
-- 
2.13.0

  reply	other threads:[~2017-05-21 20:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21 20:12 [PATCH 0/5] atm: Adjustments for some function implementations SF Markus Elfring
2017-05-21 20:14 ` SF Markus Elfring [this message]
2017-05-21 20:15 ` [PATCH 2/5] atm: Delete an error message for a failed memory allocation in make_entry() SF Markus Elfring
2017-05-21 20:16 ` [PATCH 3/5] atm: Adjust 19 checks for null pointers SF Markus Elfring
2017-05-21 20:17 ` [PATCH 4/5] atm: Use seq_puts() in lec_info() SF Markus Elfring
2017-05-21 20:18 ` [PATCH 5/5] atm: Use seq_putc() " SF Markus Elfring
2017-05-23  4:32 ` [PATCH 0/5] atm: Adjustments for some function implementations Kees Cook

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=83404a6d-c7bc-7b06-fa93-0971b1116b9d@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=augustocaringi@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jarod@redhat.com \
    --cc=javier@osg.samsung.com \
    --cc=keescook@chromium.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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

all inboxes | Powered by JetHome®