Re: [PATCH] log-writes: fix possible infinite loop in zero_range()

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Tue, Oct 17, 2017 at 6:20 AM, Hou Tao <houtao1@xxxxxxxxxx> wrote:
> Found it when trying to remove the limitation of log->max_zero_size.
>
> Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx>

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

> ---
>  src/log-writes/log-writes.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/log-writes/log-writes.c b/src/log-writes/log-writes.c
> index fab447a..0939157 100644
> --- 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);
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux