The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/3] loop: three small cleanups
@ 2026-08-25 12:57 Tao Cui
  2026-08-25 12:57 ` [PATCH 1/3] loop: drop a stale reference to loop_validate_size() Tao Cui
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tao Cui @ 2026-08-25 12:57 UTC (permalink / raw)
  To: axboe; +Cc: hch, linux-block, linux-kernel, cui.tao, Tao Cui

From: Tao Cui <cuitao@kylinos.cn>

A stale kerneldoc reference, a simple_strtol() left in the max_loop
setup code, and an unused function argument.

Tao Cui (3):
  loop: drop a stale reference to loop_validate_size()
  loop: replace simple_strtol() with kstrtoint()
  loop: drop the unused argument of lo_req_flush()

 drivers/block/loop.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] loop: drop a stale reference to loop_validate_size()
  2026-08-25 12:57 [PATCH 0/3] loop: three small cleanups Tao Cui
@ 2026-08-25 12:57 ` Tao Cui
  2026-08-25 12:57 ` [PATCH 2/3] loop: replace simple_strtol() with kstrtoint() Tao Cui
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tao Cui @ 2026-08-25 12:57 UTC (permalink / raw)
  To: axboe; +Cc: hch, linux-block, linux-kernel, cui.tao, Tao Cui

From: Tao Cui <cuitao@kylinos.cn>

The kerneldoc of loop_set_size() points readers at loop_validate_size(),
which does not exist in the tree.  Drop the reference.

Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
 drivers/block/loop.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 6f12976035b0..68a9cc7aeb13 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -212,9 +212,6 @@ static inline void loop_update_dio(struct loop_device *lo)
  * loop_set_size() - sets device size and notifies userspace
  * @lo: struct loop_device to set the size for
  * @size: new size of the loop device
- *
- * Callers must validate that the size passed into this function fits into
- * a sector_t, eg using loop_validate_size()
  */
 static void loop_set_size(struct loop_device *lo, loff_t size)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] loop: replace simple_strtol() with kstrtoint()
  2026-08-25 12:57 [PATCH 0/3] loop: three small cleanups Tao Cui
  2026-08-25 12:57 ` [PATCH 1/3] loop: drop a stale reference to loop_validate_size() Tao Cui
@ 2026-08-25 12:57 ` Tao Cui
  2026-08-25 12:57 ` [PATCH 3/3] loop: drop the unused argument of lo_req_flush() Tao Cui
  2026-08-25 22:29 ` [PATCH 0/3] loop: three small cleanups Bart Van Assche
  3 siblings, 0 replies; 5+ messages in thread
From: Tao Cui @ 2026-08-25 12:57 UTC (permalink / raw)
  To: axboe; +Cc: hch, linux-block, linux-kernel, cui.tao, Tao Cui

From: Tao Cui <cuitao@kylinos.cn>

simple_strtol() is deprecated and swallows errors.  Use kstrtoint()
in the max_loop setup code; an invalid option keeps the default and
now says so.

Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
 drivers/block/loop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 68a9cc7aeb13..8ba146e76a59 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -2341,7 +2341,8 @@ module_exit(loop_exit);
 #ifndef MODULE
 static int __init max_loop_setup(char *str)
 {
-	max_loop = simple_strtol(str, NULL, 0);
+	if (kstrtoint(str, 0, &max_loop))
+		pr_warn("loop: invalid max_loop, keeping default\n");
 #ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD
 	max_loop_specified = true;
 #endif
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] loop: drop the unused argument of lo_req_flush()
  2026-08-25 12:57 [PATCH 0/3] loop: three small cleanups Tao Cui
  2026-08-25 12:57 ` [PATCH 1/3] loop: drop a stale reference to loop_validate_size() Tao Cui
  2026-08-25 12:57 ` [PATCH 2/3] loop: replace simple_strtol() with kstrtoint() Tao Cui
@ 2026-08-25 12:57 ` Tao Cui
  2026-08-25 22:29 ` [PATCH 0/3] loop: three small cleanups Bart Van Assche
  3 siblings, 0 replies; 5+ messages in thread
From: Tao Cui @ 2026-08-25 12:57 UTC (permalink / raw)
  To: axboe; +Cc: hch, linux-block, linux-kernel, cui.tao, Tao Cui

From: Tao Cui <cuitao@kylinos.cn>

lo_req_flush() never uses its request argument.  Drop it.

Signed-off-by: Tao Cui <cuitao@kylinos.cn>
---
 drivers/block/loop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 8ba146e76a59..e7d16e5961c0 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -270,7 +270,7 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos,
 	return ret;
 }
 
-static int lo_req_flush(struct loop_device *lo, struct request *rq)
+static int lo_req_flush(struct loop_device *lo)
 {
 	int ret = vfs_fsync(lo->lo_backing_file, 0);
 	if (unlikely(ret && ret != -EINVAL))
@@ -411,7 +411,7 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)
 
 	switch (req_op(rq)) {
 	case REQ_OP_FLUSH:
-		return lo_req_flush(lo, rq);
+		return lo_req_flush(lo);
 	case REQ_OP_WRITE_ZEROES:
 		/*
 		 * If the caller doesn't want deallocation, call zeroout to
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] loop: three small cleanups
  2026-08-25 12:57 [PATCH 0/3] loop: three small cleanups Tao Cui
                   ` (2 preceding siblings ...)
  2026-08-25 12:57 ` [PATCH 3/3] loop: drop the unused argument of lo_req_flush() Tao Cui
@ 2026-08-25 22:29 ` Bart Van Assche
  3 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2026-08-25 22:29 UTC (permalink / raw)
  To: Tao Cui, axboe; +Cc: hch, linux-block, linux-kernel, Tao Cui

On 8/25/26 5:57 AM, Tao Cui wrote:
> A stale kerneldoc reference, a simple_strtol() left in the max_loop
> setup code, and an unused function argument.

All three changes look good to me, hence:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-25 22:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 12:57 [PATCH 0/3] loop: three small cleanups Tao Cui
2026-08-25 12:57 ` [PATCH 1/3] loop: drop a stale reference to loop_validate_size() Tao Cui
2026-08-25 12:57 ` [PATCH 2/3] loop: replace simple_strtol() with kstrtoint() Tao Cui
2026-08-25 12:57 ` [PATCH 3/3] loop: drop the unused argument of lo_req_flush() Tao Cui
2026-08-25 22:29 ` [PATCH 0/3] loop: three small cleanups Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox