From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-rdma@vger.kernel.org,
Chien Tin Tung <chien.tin.tung@intel.com>,
Doug Ledford <dledford@redhat.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Jason Gunthorpe <jgg@ziepe.ca>,
Johannes Berg <johannes.berg@intel.com>,
Leon Romanovsky <leonro@mellanox.com>,
Shiraz Saleem <shiraz.saleem@intel.com>,
Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions
Date: Sat, 27 Jan 2018 22:21:31 +0100 [thread overview]
Message-ID: <c3791ed7-b453-a76d-2f52-3e9d7f50d05e@users.sourceforge.net> (raw)
In-Reply-To: <b1df0889-b967-97ae-3a3d-0dde0d7258cd@users.sourceforge.net>
From: Markus Elfring <elfring@users.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@users.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
prev parent reply other threads:[~2018-01-27 21:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-27 21:17 [PATCH 0/3] RDMA/iwpm: Adjustments for three function implementations SF Markus Elfring
2018-01-27 21:19 ` [PATCH 1/3] RDMA/iwpm: Delete an error message for a failed memory allocation in iwpm_create_nlmsg() SF Markus Elfring
2018-02-28 21:14 ` Jason Gunthorpe
2018-01-27 21:20 ` [PATCH 2/3] RDMA/iwpm: Adjust a variable initialisation " SF Markus Elfring
2018-01-27 21:21 ` 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=c3791ed7-b453-a76d-2f52-3e9d7f50d05e@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=chien.tin.tung@intel.com \
--cc=dledford@redhat.com \
--cc=geert@linux-m68k.org \
--cc=jgg@ziepe.ca \
--cc=johannes.berg@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=leonro@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=shiraz.saleem@intel.com \
--cc=tatyana.e.nikolova@intel.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
Powered by JetHome