Skip to content

Commit

Permalink
[PATCH] device-mapper: list_versions fix
Browse files Browse the repository at this point in the history
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@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Alasdair G Kergon authored and Linus Torvalds committed Nov 22, 2005
1 parent b6fcc80 commit c4cc663
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ static void list_version_get_needed(struct target_type *tt, void *needed_param)
{
size_t *needed = needed_param;

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

Expand Down

0 comments on commit c4cc663

Please sign in to comment.