projects
/
xfstests-dev.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f711dfa
)
log-writes: fix possible infinite loop in zero_range()
author
Hou Tao
<houtao1@huawei.com>
Tue, 17 Oct 2017 03:20:45 +0000
(11:20 +0800)
committer
Eryu Guan
<eguan@redhat.com>
Sun, 22 Oct 2017 11:16:56 +0000
(19:16 +0800)
Found it when trying to remove the limitation of log->max_zero_size.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
src/log-writes/log-writes.c
patch
|
blob
|
history
diff --git
a/src/log-writes/log-writes.c
b/src/log-writes/log-writes.c
index fab447a86f86266a756f7645399780047b33b292..09391574c4d294c84b1f210e323a224972449065 100644
(file)
--- a/
src/log-writes/log-writes.c
+++ b/
src/log-writes/log-writes.c
@@
-65,6
+65,9
@@
static int zero_range(struct log *log, u64 start, u64 len)
memset(buf, 0, bufsize);
while (len) {
+ if (len < bufsize)
+ bufsize = len;
+
ret = pwrite(log->replayfd, buf, bufsize, start);
if (ret != bufsize) {
fprintf(stderr, "Error zeroing file: %d\n", errno);