[PATCH 4/9] memstick: Improve two size determinations in msb_resume()

From: SF Markus Elfring
Date: Sat Jan 07 2017 - 14:56:48 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Jan 2017 19:17:07 +0100

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/memstick/core/ms_block.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
index 526e671a3435..fd3d9f78bcba 100644
--- a/drivers/memstick/core/ms_block.c
+++ b/drivers/memstick/core/ms_block.c
@@ -2261,8 +2261,7 @@ static int msb_resume(struct memstick_dev *card)
return 0;
#endif
mutex_lock(&card->host->lock);
-
- new_msb = kzalloc(sizeof(struct msb_data), GFP_KERNEL);
+ new_msb = kzalloc(sizeof(*new_msb), GFP_KERNEL);
if (!new_msb)
goto out;

@@ -2277,8 +2276,9 @@ static int msb_resume(struct memstick_dev *card)
if (msb->block_size != new_msb->block_size)
goto out;

- if (memcmp(msb->boot_page, new_msb->boot_page,
- sizeof(struct ms_boot_page)))
+ if (memcmp(msb->boot_page,
+ new_msb->boot_page,
+ sizeof(*msb->boot_page)))
goto out;

if (msb->logical_block_count != new_msb->logical_block_count ||
--
2.11.0