[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <683a3165-76e9-6b49-d6b1-695456ba3b75@users.sourceforge.net>
Date: Wed, 10 Jan 2018 15:05:31 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: kernel-janitors@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Robin Holt <robinmholt@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/3] sgi-xpc: Improve a size determination in two functions
From: Markus Elfring <elfring@...rs.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@...rs.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
Powered by blists - more mailing lists