[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <08ff35e1-d9f4-2296-c641-d6a28e951594@users.sourceforge.net>
Date: Tue, 7 Feb 2017 20:46:47 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-input@...r.kernel.org,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Bruno Prémont <bonbons@...ux-vserver.org>,
Jiri Kosina <jikos@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 05/18] HID: Improve two size determinations in
hid_open_report()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Mon, 6 Feb 2017 22:00:07 +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.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/hid/hid-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 404eccd0d670..16c73bf49d55 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -975,7 +975,7 @@ int hid_open_report(struct hid_device *device)
device->rdesc = start;
device->rsize = size;
- parser = vzalloc(sizeof(struct hid_parser));
+ parser = vzalloc(sizeof(*parser));
if (!parser) {
ret = -ENOMEM;
goto err;
@@ -986,7 +986,7 @@ int hid_open_report(struct hid_device *device)
end = start + size;
device->collection = kcalloc(HID_DEFAULT_NUM_COLLECTIONS,
- sizeof(struct hid_collection), GFP_KERNEL);
+ sizeof(*device->collection), GFP_KERNEL);
if (!device->collection) {
ret = -ENOMEM;
goto err;
--
2.11.1
Powered by blists - more mailing lists