Thread (31 messages) 31 messages, 2 authors, 2021-02-02

[RFC PATCH 14/20] loop: remove memset in info64 from compat

flat view
STALE2090d

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:38:39
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

In current code loop_info64_from_compat() is only called from the one
caller loop_set_status_compat(). Initialize the info64 local variable
to zero before we pass it to the loop_info64_compat() so that we can get
rid of the memset in the loop_info64_from_compat().

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 drivers/block/loop.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 667a3945bf39..2029ca399ea3 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1731,7 +1731,6 @@ loop_info64_from_compat(const struct compat_loop_info __user *arg,
 	if (copy_from_user(&info, arg, sizeof(info)))
 		return -EFAULT;
 
-	memset(info64, 0, sizeof(*info64));
 	info64->lo_number = info.lo_number;
 	info64->lo_device = info.lo_device;
 	info64->lo_inode = info.lo_inode;
@@ -1794,7 +1793,7 @@ loop_info64_to_compat(const struct loop_info64 *info64,
 static int loop_set_status_compat(struct loop_device *lo,
 				 const struct compat_loop_info __user *arg)
 {
-	struct loop_info64 info64;
+	struct loop_info64 info64 = { };
 	int ret;
 
 	ret = loop_info64_from_compat(arg, &info64);
-- 
2.22.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help