[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3791ed7-b453-a76d-2f52-3e9d7f50d05e@users.sourceforge.net>
Date: Sat, 27 Jan 2018 22:21:31 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-rdma@...r.kernel.org,
Chien Tin Tung <chien.tin.tung@...el.com>,
Doug Ledford <dledford@...hat.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Jason Gunthorpe <jgg@...pe.ca>,
Johannes Berg <johannes.berg@...el.com>,
Leon Romanovsky <leonro@...lanox.com>,
Shiraz Saleem <shiraz.saleem@...el.com>,
Tatyana Nikolova <tatyana.e.nikolova@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 27 Jan 2018 22:05:54 +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/infiniband/core/iwpm_util.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9eb527074c32..902a2677df31 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -121,7 +121,8 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
if (!iwpm_valid_client(nl_client))
return ret;
- map_info = kzalloc(sizeof(struct iwpm_mapping_info), GFP_KERNEL);
+
+ map_info = kzalloc(sizeof(*map_info), GFP_KERNEL);
if (!map_info)
return -ENOMEM;
@@ -298,7 +299,7 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,
struct iwpm_nlmsg_request *nlmsg_request = NULL;
unsigned long flags;
- nlmsg_request = kzalloc(sizeof(struct iwpm_nlmsg_request), gfp);
+ nlmsg_request = kzalloc(sizeof(*nlmsg_request), gfp);
if (!nlmsg_request)
return NULL;
--
2.16.1
Powered by blists - more mailing lists