diff --git a/fs/dirty_pages.c b/fs/dirty_pages.c index b0cf442c573025921cf120be6bc6be6d5e2477db..f75a5158d94b25d56c344fbe1e6d0c40036a1ef5 100644 --- a/fs/dirty_pages.c +++ b/fs/dirty_pages.c @@ -218,6 +218,9 @@ static ssize_t seq_read_dirty( } n = min(m->count - m->from, size); + /* check if this is the last read */ + if (n == 0) + goto done; n -= copy_to_user(buf, m->buf + m->from, n); if (unlikely(!n)) { err = -EFAULT;