Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639858

[PATCH 1/4] vmbus: Improve a size determination in vmbus_device_create()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 1/4] vmbus: Improve a size determination in vmbus_device_create()
Date 2017-05-11 18:20 +0200
Message-ID <tFYYO-ax-27@gated-at.bofh.it> (permalink)
References <tFYYN-ax-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 17:30:10 +0200

Replace the specification of a data structure by a pointer dereference
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@users.sourceforge.net>
---
 drivers/hv/vmbus_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 0087b49095eb..6802d74f162c 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1145,5 +1145,5 @@ struct hv_device *vmbus_device_create(const uuid_le *type,
 {
 	struct hv_device *child_device_obj;
 
-	child_device_obj = kzalloc(sizeof(struct hv_device), GFP_KERNEL);
+	child_device_obj = kzalloc(sizeof(*child_device_obj), GFP_KERNEL);
 	if (!child_device_obj) {
-- 
2.12.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] VMBus: Adjustments for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-11 18:20 +0200
  [PATCH 1/4] vmbus: Improve a size determination in  vmbus_device_create() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-11 18:20 +0200
    Re: [PATCH 1/4] vmbus: Improve a size determination in  vmbus_device_create() Stephen Hemminger <stephen@networkplumber.org> - 2017-05-11 18:40 +0200
      Re: [PATCH 1/4] vmbus: Improve a size determination in  vmbus_device_create() Greg KH <greg@kroah.com> - 2017-05-11 19:50 +0200
  [PATCH 4/4] vmbus: Adjust five checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-11 18:30 +0200
    Re: [PATCH 4/4] vmbus: Adjust five checks for null pointers Stephen Hemminger <stephen@networkplumber.org> - 2017-05-11 18:40 +0200

csiph-web