projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d5ffebd
)
dm log writes: fix max length used for kstrndup
author
Ma Shimiao
<mashimiao.fnst@cn.fujitsu.com>
Tue, 12 Dec 2017 09:39:10 +0000
(17:39 +0800)
committer
Mike Snitzer
<snitzer@redhat.com>
Wed, 17 Jan 2018 14:16:16 +0000
(09:16 -0500)
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>
drivers/md/dm-log-writes.c
patch
|
blob
|
history
diff --git
a/drivers/md/dm-log-writes.c
b/drivers/md/dm-log-writes.c
index 189badbeddaf7bf39ffd97544232aa8ba7a2f9d4..3362d866793b320149bcb7a83b663e1bb68cf927 100644
(file)
--- a/
drivers/md/dm-log-writes.c
+++ b/
drivers/md/dm-log-writes.c
@@
-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);