From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Robin Holt <robinmholt@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] sgi-xpc: Improve a size determination in two functions
Date: Wed, 10 Jan 2018 15:05:31 +0100 [thread overview]
Message-ID: <683a3165-76e9-6b49-d6b1-695456ba3b75@users.sourceforge.net> (raw)
In-Reply-To: <cf88f891-5960-ff01-b8b5-b8194ceff4f1@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 14:18:12 +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>
---
drivers/misc/sgi-xp/xpc_uv.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 0c95f9994649..8a8dfcbbe729 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -212,10 +212,9 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name,
int nasid;
int pg_order;
struct page *page;
- struct xpc_gru_mq_uv *mq;
struct uv_IO_APIC_route_entry *mmr_value;
+ struct xpc_gru_mq_uv *mq = kmalloc(sizeof(*mq), GFP_KERNEL);
- mq = kmalloc(sizeof(struct xpc_gru_mq_uv), GFP_KERNEL);
if (mq == NULL) {
ret = -ENOMEM;
goto out_0;
@@ -686,9 +685,7 @@ xpc_send_activate_IRQ_uv(struct xpc_partition *part, void *msg, size_t msg_size,
if (!(part_uv->flags & XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV)) {
gru_mq_desc = part_uv->cached_activate_gru_mq_desc;
if (gru_mq_desc == NULL) {
- gru_mq_desc = kmalloc(sizeof(struct
- gru_message_queue_desc),
- GFP_KERNEL);
+ gru_mq_desc = kmalloc(sizeof(*gru_mq_desc), GFP_KERNEL);
if (gru_mq_desc == NULL) {
ret = xpNoMemory;
goto done;
--
2.15.1
next prev parent reply other threads:[~2018-01-10 14:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 14:03 [PATCH 0/3] SGI-XPC: Adjustments for some function implementations SF Markus Elfring
2018-01-10 14:04 ` [PATCH 1/3] sgi-xpc: Delete error messages for a failed memory allocation in three functions SF Markus Elfring
2018-01-11 18:16 ` Robin Holt
2018-01-10 14:05 ` SF Markus Elfring [this message]
2018-01-11 18:16 ` [PATCH 2/3] sgi-xpc: Improve a size determination in two functions Robin Holt
2018-01-10 14:06 ` [PATCH 3/3] sgi-xpc: Adjust 27 checks for null pointers SF Markus Elfring
2018-01-11 18:17 ` Robin Holt
2018-01-11 18:19 ` [PATCH 0/3] SGI-XPC: Adjustments for some function implementations Robin Holt
2018-01-11 20:21 ` Greg Kroah-Hartman
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=683a3165-76e9-6b49-d6b1-695456ba3b75@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robinmholt@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
all inboxes | Powered by JetHome®