On Thu, 2006-09-21 at 10:10 -0400, Vivek Goyal wrote:
On Thu, Sep 21, 2006 at 09:02:37PM +1000, Michael Ellerman wrote:
quoted
+
+static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize,
+ unsigned long offset, int userbuf)
+{
+ if (userbuf) {
+ if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
+ return -EFAULT;
+ }
Probably you can get rid of above pair of braces as there is only single
statement under if.
Yep.
quoted
- if (userbuf) {
- if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
- iounmap(vaddr);
- return -EFAULT;
- }
- } else
- memcpy(buf, (vaddr + offset), csize);
+ if (pfn < max_pfn) {
Should this be (pfn <= max_pfn) ?
No, max_pfn is badly named. It seems to actually be the total number of
pages == the first pfn past the end of the linear mapping.
But it'd be cleaner to use page_is_ram(), I'll do a new patch.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person