diff mbox series

[RFC,16/20] loop: remove memset in loop_info64_to_old()

Message ID 20210202053552.4844-17-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series loop: cleanup and small improvement | expand

Commit Message

Chaitanya Kulkarni Feb. 2, 2021, 5:35 a.m. UTC
In current code loop_info64_to_old() is only called from the one caller
loop_get_status_old(). Initialize the info local variable to zero
before we pass it to the loop_info64_from_old() so that we can get rid
of the memset in the loop_info64_to_old().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/block/loop.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Johannes Thumshirn Feb. 2, 2021, 11:59 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 62f622791fb5..af3e3bcd564d 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1481,7 +1481,6 @@  static void loop_info64_from_old(const struct loop_info *info,
 static int loop_info64_to_old(const struct loop_info64 *info64,
 			      struct loop_info *info)
 {
-	memset(info, 0, sizeof(*info));
 	info->lo_number = info64->lo_number;
 	info->lo_device = info64->lo_device;
 	info->lo_inode = info64->lo_inode;
@@ -1533,7 +1532,7 @@  static int loop_set_status64(struct loop_device *lo,
 static int loop_get_status_old(struct loop_device *lo,
 			       struct loop_info __user *arg)
 {
-	struct loop_info info;
+	struct loop_info info = { };
 	struct loop_info64 info64;
 	int err;