Skip to contentSkip to conversation

s390/extmem: Use kmalloc_array() in dcss_set_subcodes()

PATCH New SF Markus Elfring 1 participant 1 message Sep 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/extmem: Use kmalloc_array() in dcss_set_subcodes()

From: Markus Elfring <[email protected]>
Date: Sat, 3 Sep 2016 16:06:05 +0200

* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array".

* Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention.

---
 arch/s390/mm/extmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/mm/extmem.c +1 -1
index 02042b6..4d18301 100644
@@ -102,7 +102,7 @@ static int scode_set;
 static int
 dcss_set_subcodes(void)
 {
-	char *name = kmalloc(8 * sizeof(char), GFP_KERNEL | GFP_DMA);
+	char *name = kmalloc_array(8, sizeof(*name), GFP_KERNEL | GFP_DMA);
 	unsigned long rx, ry;
 	int rc;
 
Signature · 1 line
2.9.3