[PATCH] device-mapper: list_versions fix

From: Alasdair G Kergon
Date: Fri Nov 18 2005 - 09:52:16 EST


In some circumstances the LIST_VERSIONS output is truncated
because the size calculation forgets about a 'uint32_t' in each
structure - but the inclusion of the whole of ALIGN_MASK frequently
compensates for the omission.

This is a quick workaround to use an upper bound. (The code ought
to be fixed to supply the actual size.)

Running 'dmsetup targets' may demonstrate the problem: when I run it,
the last line comes out as 'erro' instead of 'error'.
Consequently, 'lvcreate --type error' doesn't work.

Signed-Off-By: Alasdair G Kergon <agk@xxxxxxxxxx>

Index: linux-2.6.14-rc2/drivers/md/dm-ioctl.c
===================================================================
--- linux-2.6.14-rc2.orig/drivers/md/dm-ioctl.c 2005-10-26 20:22:59.000000000 +0100
+++ linux-2.6.14-rc2/drivers/md/dm-ioctl.c 2005-11-03 21:54:07.000000000 +0000
@@ -425,8 +425,8 @@ static void list_version_get_needed(stru
{
size_t *needed = needed_param;

+ *needed += sizeof(struct dm_target_versions);
*needed += strlen(tt->name);
- *needed += sizeof(tt->version);
*needed += ALIGN_MASK;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/