[prev in list] [next in list] [prev in thread] [next in thread] 

List:       osdl-fastboot
Subject:    [Fastboot] Re: [PATCH][5/6]ELF format dump file access
From:       Andrew Morton <akpm () osdl ! org>
Date:       2004-09-15 21:31:11
Message-ID: 20040915143111.23dac3d7.akpm () osdl ! org
[Download RAW message or body]

Hariprasad Nellitheertha <hari@in.ibm.com> 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.


_______________________________________________
fastboot mailing list
fastboot@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/fastboot


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic