[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080312100831.GB21854@linux-sh.org>
Date: Wed, 12 Mar 2008 19:08:31 +0900
From: Paul Mundt <lethal@...ux-sh.org>
To: Ben Nizette <bn@...sdigital.com>
Cc: gregkh@...e.de, linux-kernel <linux-kernel@...r.kernel.org>,
hjk@...utronix.de
Subject: Re: [PATCH] UIO: Implement a UIO interface for the SMX Cryptengine
On Tue, Mar 11, 2008 at 03:57:10PM +1100, Ben Nizette wrote:
> + regs = platform_get_resource(dev, IORESOURCE_MEM, 0);
> + if (!regs)
> + goto out_free;
> +
> + info->mem[0].addr = regs->start;
> + if (!info->mem[0].addr)
> + goto out_free;
> + info->mem[0].internal_addr = ioremap(regs->start, regs->end -
> regs->start);
> + if (!info->mem[0].internal_addr)
> + goto out_free;
> +
> + info->mem[0].size = regs->end - regs->start;
> + info->mem[0].memtype = UIO_MEM_PHYS;
> +
You have an off-by-1 in the resource size. ioremap and struct resource
are not equal in their expectations. You probably want to do something
like:
info->mem[0].size = regs->end - regs->start + 1;
info->mem[0].internal_addr = ioremap(regs->start, info->mem[0].size);
...
and make sure that your resource end doesn't overlap with a start address
of an unrelated resource in your definition. /proc/iomem tends to be
useful for this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists