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


Groups > linux.kernel > #1715387

[PATCH 2/3] jffs2: Improve a size determination in jffs2_scan_medium()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/3] jffs2: Improve a size determination in jffs2_scan_medium()
Date 2017-08-18 21:10 +0200
Message-ID <ufUOD-7Rd-23@gated-at.bofh.it> (permalink)
References <ufUOB-7Rd-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 18 Aug 2017 20:22:15 +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>
---
 fs/jffs2/scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 90431dd613b8..d7696151b47d 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -132,5 +132,5 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
 	}
 
 	if (jffs2_sum_active()) {
-		s = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
+		s = kzalloc(sizeof(*s), GFP_KERNEL);
 		if (!s) {
-- 
2.14.0

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


Thread

[PATCH 0/3] JFFS2: Adjustments for seven function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200
  [PATCH 3/3] jffs2: Adjust a null pointer check in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200
  [PATCH 2/3] jffs2: Improve a size determination in  jffs2_scan_medium() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200
  [PATCH 1/3] jffs2: Delete an error message for a failed memory  allocation in four functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-18 21:10 +0200

csiph-web