netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-sctp@vger.kernel.org, netdev@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Neil Horman <nhorman@tuxdriver.com>,
	Vlad Yasevich <vyasevich@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event()
Date: Mon, 22 May 2017 18:40:37 +0200	[thread overview]
Message-ID: <a96c883f-0495-ad8c-e3a4-c80f27b76ed2@users.sourceforge.net> (raw)
In-Reply-To: <2845df67-d35d-536a-0a53-b2eb83fe1ba5@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 22 May 2017 18:08:24 +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>
---
 net/sctp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 64756c42cec9..057479b7bd72 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -784,7 +784,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
 
 	switch (ev) {
 	case NETDEV_UP:
-		addr = kmalloc(sizeof(struct sctp_sockaddr_entry), GFP_ATOMIC);
+		addr = kmalloc(sizeof(*addr), GFP_ATOMIC);
 		if (addr) {
 			addr->a.v4.sin_family = AF_INET;
 			addr->a.v4.sin_port = 0;
-- 
2.13.0

  parent reply	other threads:[~2017-05-22 16:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-22 16:35 [PATCH 0/5] net-SCTP: Adjustments for three function implementations SF Markus Elfring
2017-05-22 16:37 ` [PATCH 1/5] sctp: Use kmalloc_array() in sctp_init() SF Markus Elfring
2017-05-22 19:51   ` Marcelo Ricardo Leitner
2017-05-22 20:57   ` Vlad Yasevich
2017-05-22 16:38 ` [PATCH 2/5] sctp: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-22 16:56   ` Marcelo Ricardo Leitner
2017-05-22 19:46     ` SF Markus Elfring
2017-05-22 19:50       ` Marcelo Ricardo Leitner
2017-05-22 19:52   ` Marcelo Ricardo Leitner
2017-05-22 20:59   ` Vlad Yasevich
2017-05-22 16:39 ` [PATCH 3/5] sctp: Fix a typo in a comment line " SF Markus Elfring
2017-05-22 19:52   ` Marcelo Ricardo Leitner
2017-05-22 21:00   ` Vlad Yasevich
2017-05-22 16:40 ` SF Markus Elfring [this message]
2017-05-22 19:52   ` [PATCH 4/5] sctp: Improve a size determination in sctp_inetaddr_event() Marcelo Ricardo Leitner
2017-05-22 21:00   ` Vlad Yasevich
2017-05-22 16:41 ` [PATCH 5/5] sctp: Adjust one function call together with a variable assignment SF Markus Elfring
2017-05-22 19:53   ` Marcelo Ricardo Leitner
2017-05-22 21:00   ` Vlad Yasevich
2017-05-23  6:34 ` [PATCH 0/5] net-SCTP: Adjustments for three function implementations Xin Long

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=a96c883f-0495-ad8c-e3a4-c80f27b76ed2@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=vyasevich@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).