Commit c1d91a0d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] dm-ioctl.c: fix off-by-one error

From: Kevin Corry <kevcorry@us.ibm.com>

Fix an OB1 error when calculating an output buffer size, that could cause a
missing null termininator in the 'list devices' ioctl results.  [Steffan
Paletta]
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent edf6250b
...@@ -377,7 +377,7 @@ static int list_devices(struct dm_ioctl *param, size_t param_size) ...@@ -377,7 +377,7 @@ static int list_devices(struct dm_ioctl *param, size_t param_size)
for (i = 0; i < NUM_BUCKETS; i++) { for (i = 0; i < NUM_BUCKETS; i++) {
list_for_each_entry (hc, _name_buckets + i, name_list) { list_for_each_entry (hc, _name_buckets + i, name_list) {
needed += sizeof(struct dm_name_list); needed += sizeof(struct dm_name_list);
needed += strlen(hc->name); needed += strlen(hc->name) + 1;
needed += ALIGN_MASK; needed += ALIGN_MASK;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment