lkml.org 
[lkml]   [2017]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] atm: Improve a size determination in adummy_init()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 1 Oct 2017 21:35:18 +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.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/atm/adummy.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 94b73ddfb731..1ef2d8ee8d67 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -146,9 +146,7 @@ static int __init adummy_init(void)
int err = 0;

printk(KERN_ERR "adummy: version %s\n", DRV_VERSION);
-
- adummy_dev = kzalloc(sizeof(struct adummy_dev),
- GFP_KERNEL);
+ adummy_dev = kzalloc(sizeof(*adummy_dev), GFP_KERNEL);
if (!adummy_dev) {
err = -ENOMEM;
goto out;
--
2.14.2
\
 
 \ /
  Last update: 2017-10-01 21:51    [W:0.035 / U:5.728 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site