mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
dm log writes: fix max length used for kstrndup
If source string is longer than max, kstrndup will allocate max+1 space. So make sure the result will not exceed max. Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
d5ffebdd79
commit
4b259fc4a8
@ -594,7 +594,7 @@ static int log_mark(struct log_writes_c *lc, char *data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
block->data = kstrndup(data, maxsize, GFP_KERNEL);
|
||||
block->data = kstrndup(data, maxsize - 1, GFP_KERNEL);
|
||||
if (!block->data) {
|
||||
DMERR("Error copying mark data");
|
||||
kfree(block);
|
||||
|
Loading…
Reference in New Issue
Block a user