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


Groups > linux.kernel > #1742886 > unrolled thread

[PATCH 0/2] atm: Adjustments for adummy_init()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-10-01 21:50 +0200
Last post2017-10-01 22:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] atm: Adjustments for adummy_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-01 21:50 +0200
    [PATCH 2/2] atm: Improve a size determination in adummy_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-01 22:00 +0200

#1742886 — [PATCH 0/2] atm: Adjustments for adummy_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-10-01 21:50 +0200
Subject[PATCH 0/2] atm: Adjustments for adummy_init()
Message-ID<uvSps-6bk-23@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 1 Oct 2017 21:43:21 +0200

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an error message for a failed memory allocation
  Improve a size determination

 drivers/atm/adummy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

-- 
2.14.2

[toc] | [next] | [standalone]


#1742888 — [PATCH 2/2] atm: Improve a size determination in adummy_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-10-01 22:00 +0200
Subject[PATCH 2/2] atm: Improve a size determination in adummy_init()
Message-ID<uvSz7-6eE-7@gated-at.bofh.it>
In reply to#1742886
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web