[PATCH 3/3] mtdswap: Improve a size determination in mtdswap_erase_block()

SF Markus Elfring elfring at users.sourceforge.net
Mon May 8 08:10:03 PDT 2017


From: Markus Elfring <elfring at users.sourceforge.net>
Date: Mon, 8 May 2017 16:51:30 +0200

Replace the specification of a data structure by a name for
a local variable as the parameter for the operator "sizeof" to make
the corresponding size determination a bit safer.

Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
---
 drivers/mtd/mtdswap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index f73fb0909b0c..c748515f8533 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -559,8 +559,7 @@ static int mtdswap_erase_block(struct mtdswap_dev *d, struct swap_eb *eb)
 
 retry:
 	init_waitqueue_head(&wq);
-	memset(&erase, 0, sizeof(struct erase_info));
-
+	memset(&erase, 0, sizeof(erase));
 	erase.mtd	= mtd;
 	erase.callback	= mtdswap_erase_callback;
 	erase.addr	= mtdswap_eb_offset(d, eb);
-- 
2.12.2




More information about the linux-mtd mailing list