Re: [PATCH][5/6]ELF format dump file access

From: Andrew Morton
Date: Wed Sep 15 2004 - 19:14:49 EST


Hariprasad Nellitheertha <hari@xxxxxxxxxx> wrote:
>
> +/*
> + * Reads from the oldmem device from given offset till
> + * given count
> + */
> +static ssize_t read_from_oldmem(char *buf, size_t count,
> + loff_t *ppos, int userbuf)
> +{
> + unsigned long pfn, p = *ppos;
> + size_t read = 0;
> +
> + pfn = p / PAGE_SIZE;
> + p = p % PAGE_SIZE;
> +
> + if (pfn > saved_max_pfn) {
> + read = -EINVAL;
> + goto done;
> + }
> +
> + if (count > PAGE_SIZE - p)
> + count = PAGE_SIZE - p;
> +
> + if (copy_oldmem_page(pfn, buf, count, userbuf)) {
> + read = -EFAULT;
> + goto done;
> + }
> +
> + *ppos += count;

hm, what's going on here? *ppos is a loff_t but you've copied it
into a 32-bit local prior to calculating the pfn.
-
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/