Re: [PATCH 1/5] pagemap: Modify add_to_pagemap to use copy_to_userinstead of put_user.

From: Matt Mackall
Date: Thu Jun 05 2008 - 11:58:37 EST



On Thu, 2008-06-05 at 11:04 -0400, Thomas Tuttle wrote:
> While fiddling with pagemap, I discovered a bug in add_to_pagemap.
> When it is copying an entry that is not at the end of the buffer, it
> uses put_user to copy a u64 into a char* buffer. The problem is that
> put_user determines how much to copy based on the size of the
> *destination*, not the source, so it only copied one byte. To fix
> this, I replaced the call to put_user with a call to copy_to_user, as
> is used when copying the last (possibly partial) PFN into the buffer.

This looks fine to me, so:

Acked-by: Matt Mackall <mpm@xxxxxxxxxxx>

But your 3/5 undoes this, right? So we should just take one or the other
route. While I like going the simplifying route, it's not very pretty
from the user interface point of view. But it does have plenty of
precedent in direct-I/O-like things.

--
Mathematics is the supreme nostalgia of our time.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/