Skip to contentSkip to conversation

mm/zswap.c: improve a size determination in zswap_frontswap_init()

PATCH New [email protected] 1 participant 1 message Jul 6, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 99/108 mm/zswap.c: improve a size determination in zswap_frontswap_init()

From: Markus Elfring <[email protected]>
Subject: mm/zswap.c: improve a size determination in zswap_frontswap_init()

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.

---

 mm/zswap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zswap.c renamed from mm/zswap.c~zswap-improve-a-size-determination-in-zswap_frontswap_init +1 -1
diff -puN mm/zswap.c~zswap-improve-a-size-determination-in-zswap_frontswap_init mm/zswap.c
@@ -1156,7 +1156,7 @@ static void zswap_frontswap_init(unsigne
 {
 	struct zswap_tree *tree;
 
-	tree = kzalloc(sizeof(struct zswap_tree), GFP_KERNEL);
+	tree = kzalloc(sizeof(*tree), GFP_KERNEL);
 	if (!tree) {
 		pr_err("alloc failed, zswap disabled for swap type %d\n", type);
 		return;

_