[PATCH] dm-ioctl: delete a useless condition

Mikulas Patocka <[email protected]> Mon, 13 Jul 2026 21:25:21 +0200 (CEST)
Newsgroups dev.linux.lists.dm-devel
Message-ID <[email protected]>
The condition "remaining <= 0" can never be true. The variable remaining
has type size_t, thus it can't be negative. It can't be zero because we
made sure earlier that "remaining > sizeof(struct dm_target_spec)" and
then we added "sizeof(struct dm_target_spec)" to "outptr" (this means
that we subtraceted "sizeof(struct dm_target_spec)" from "remaining").

Signed-off-by: Mikulas Patocka <[email protected]>
Assisted-by: Claude:claude-opus-4.6

---
 drivers/md/dm-ioctl.c |    4 ----
 1 file changed, 4 deletions(-)

Index: linux-2.6/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-ioctl.c	2026-07-09 21:41:36.000000000 +0200
+++ linux-2.6/drivers/md/dm-ioctl.c	2026-07-09 21:41:36.000000000 +0200
@@ -1444,10 +1444,6 @@ static void retrieve_status(struct dm_ta
 
 		outptr += sizeof(struct dm_target_spec);
 		remaining = len - (outptr - outbuf);
-		if (remaining <= 0) {
-			param->flags |= DM_BUFFER_FULL_FLAG;
-			break;
-		}
 
 		/* Get the status/table string from the target driver */
 		if (ti->type->status) {