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


Groups > linux.kernel > #1743299

[PATCH 2/6] ARM: s3c24xx: Improve a size determination in s3c2410_iotiming_get()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/6] ARM: s3c24xx: Improve a size determination in s3c2410_iotiming_get()
Date 2017-10-02 22:50 +0200
Message-ID <uwfPf-ur-227@gated-at.bofh.it> (permalink)
References <uwfP5-ur-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 2 Oct 2017 19:16:58 +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>
---
 arch/arm/mach-s3c24xx/iotiming-s3c2410.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2410.c b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c
index f587c78fba33..c18769b5f15a 100644
--- a/arch/arm/mach-s3c24xx/iotiming-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/iotiming-s3c2410.c
@@ -453,7 +453,7 @@ int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
 		s3c_freq_iodbg("%s: bank %d: con %08lx\n",
 			       __func__, bank, bankcon);
 
-		bt = kzalloc(sizeof(struct s3c2410_iobank_timing), GFP_KERNEL);
+		bt = kzalloc(sizeof(*bt), GFP_KERNEL);
 		if (!bt)
 			return -ENOMEM;
 
-- 
2.14.2

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


Thread

[PATCH 0/6] ARM-S3C24xx: Adjustments for four function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-02 22:50 +0200
  [PATCH 3/6] ARM: s3c2410: Fix a typo in a comment line SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-02 22:50 +0200
  [PATCH 5/6] ARM: s3c24xx: Improve a size determination in  s3c2412_iotiming_get() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-02 22:50 +0200
  [PATCH 2/6] ARM: s3c24xx: Improve a size determination in  s3c2410_iotiming_get() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-02 22:50 +0200
  [PATCH 1/6] ARM: s3c24xx: Delete an error message for a failed memory  allocation in s3c2410_iotiming_get() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-10-02 22:50 +0200

csiph-web