public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Ben Nizette <bn@niasdigital.com>
Cc: gregkh@suse.de, linux-kernel <linux-kernel@vger.kernel.org>,
	hjk@linutronix.de
Subject: Re: [PATCH] UIO: Implement a UIO interface for the SMX Cryptengine
Date: Wed, 12 Mar 2008 19:08:31 +0900	[thread overview]
Message-ID: <20080312100831.GB21854@linux-sh.org> (raw)
In-Reply-To: <1205211430.3817.15.camel@moss.renham>

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.

  parent reply	other threads:[~2008-03-12 10:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11  4:57 [PATCH] UIO: Implement a UIO interface for the SMX Cryptengine Ben Nizette
2008-03-11  8:15 ` Hans-Jürgen Koch
2008-03-12  9:54   ` Ben Nizette
2008-03-12 10:08 ` Paul Mundt [this message]
2008-03-12 10:41   ` Ben Nizette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080312100831.GB21854@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=bn@niasdigital.com \
    --cc=gregkh@suse.de \
    --cc=hjk@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox