From: SF Markus Elfring <elfring@users.sourceforge.net>
To: tipc-discussion@lists.sourceforge.net, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Jon Maloy <jon.maloy@ericsson.com>,
Ying Xue <ying.xue@windriver.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] tipc: Improve a size determination in two functions
Date: Wed, 8 Nov 2017 22:35:31 +0100 [thread overview]
Message-ID: <af489a34-178f-a020-0b09-89f32fa12204@users.sourceforge.net> (raw)
In-Reply-To: <25790616-164d-fe3e-bda4-3155299a8171@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 Nov 2017 22:23:07 +0100
Replace the specification of 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.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
net/tipc/server.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/tipc/server.c b/net/tipc/server.c
index 7359d37e39cd..5d001b6acbe5 100644
--- a/net/tipc/server.c
+++ b/net/tipc/server.c
@@ -219,7 +219,7 @@ static struct tipc_conn *tipc_alloc_conn(struct tipc_server *s)
struct tipc_conn *con;
int ret;
- con = kzalloc(sizeof(struct tipc_conn), GFP_ATOMIC);
+ con = kzalloc(sizeof(*con), GFP_ATOMIC);
if (!con)
return ERR_PTR(-ENOMEM);
@@ -410,7 +410,7 @@ static struct outqueue_entry *tipc_alloc_entry(void *data, int len)
struct outqueue_entry *entry;
void *buf;
- entry = kmalloc(sizeof(struct outqueue_entry), GFP_ATOMIC);
+ entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
if (!entry)
return NULL;
--
2.15.0
prev parent reply other threads:[~2017-11-08 21:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 21:33 [PATCH 0/2] tipc: Fine-tuning for three function implementations SF Markus Elfring
2017-11-08 21:34 ` [PATCH 1/2] tipc: Use common error handling code in tipc_server_start() SF Markus Elfring
2017-11-08 21:35 ` SF Markus Elfring [this message]
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=af489a34-178f-a020-0b09-89f32fa12204@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=davem@davemloft.net \
--cc=jon.maloy@ericsson.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.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).