From: SF Markus Elfring <elfring@users.sourceforge.net>
To: "Andrew F. Davis" <afd@ti.com>,
Christophe Jaillet <christophe.jaillet@wanadoo.fr>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>,
Evgeniy Polyakov <zbr@ioremap.net>,
"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
Sebastian Reichel <sre@kernel.org>,
Wei Yongjun <weiyongjun1@huawei.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/4] w1: Improve a size determination in two functions
Date: Mon, 21 Aug 2017 22:54:52 +0200 [thread overview]
Message-ID: <4a01f6e8-6054-db98-a738-e42dd23a76b9@users.sourceforge.net> (raw)
In-Reply-To: <cb845ee0-0826-6a68-1246-0beab38129c1@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 21 Aug 2017 21:17:01 +0200
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/w1/slaves/w1_ds28e04.c | 2 +-
drivers/w1/w1.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/w1/slaves/w1_ds28e04.c b/drivers/w1/slaves/w1_ds28e04.c
index ec234b846eb3..794db5e8f46f 100644
--- a/drivers/w1/slaves/w1_ds28e04.c
+++ b/drivers/w1/slaves/w1_ds28e04.c
@@ -397,5 +397,5 @@ static int w1_f1C_add_slave(struct w1_slave *sl)
struct w1_f1C_data *data = NULL;
if (w1_enable_crccheck) {
- data = kzalloc(sizeof(struct w1_f1C_data), GFP_KERNEL);
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index f26c1ea280dd..9f71dc7aca3a 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -711,5 +711,5 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
int err;
struct w1_netlink_msg msg;
- sl = kzalloc(sizeof(struct w1_slave), GFP_KERNEL);
+ sl = kzalloc(sizeof(*sl), GFP_KERNEL);
if (!sl)
--
2.14.0
next prev parent reply other threads:[~2017-08-21 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 20:52 [PATCH 0/4] w1: Adjustments for some function implementations SF Markus Elfring
2017-08-21 20:53 ` [PATCH 1/4] w1: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-08-21 20:54 ` SF Markus Elfring [this message]
2017-08-21 20:56 ` [PATCH 3/4] w1-masters: Delete an error message for a failed memory allocation in four functions SF Markus Elfring
2017-08-21 20:57 ` [PATCH 4/4] w1-masters: Improve a size determination " SF Markus Elfring
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=4a01f6e8-6054-db98-a738-e42dd23a76b9@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=afd@ti.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=garsilva@embeddedor.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=sre@kernel.org \
--cc=weiyongjun1@huawei.com \
--cc=zbr@ioremap.net \
/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