[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48DDDDDE.7060707@goop.org>
Date: Sat, 27 Sep 2008 00:16:46 -0700
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Suresh Siddha <suresh.b.siddha@...el.com>
CC: jbarnes@...tuousgeek.org, mingo@...e.hu, tglx@...utronix.de,
hpa@...or.com, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, arjan@...ux.intel.com,
linux-kernel@...r.kernel.org
Subject: Re: [patch] ioremap sanity check to catch mapping requests exceeding
the BAR sizes
Suresh Siddha wrote:
> +int iomem_map_sanity_check(resource_size_t addr, unsigned long size)
> +{
> + struct resource *p = &iomem_resource;
> + int err = 0;
> + loff_t l;
> +
> + read_lock(&resource_lock);
> + for (p = p->child; p ; p = r_next(NULL, p, &l)) {
> + /*
> + * We can probably skip the resources with out
> + * IORESOURCE_IO attribute?
>
Any attempt to use ioremap on memory is a bug, so you should warn about
that too.
> + */
> + if (p->start >= addr + size)
> + continue;
> + if (p->end < addr)
> + continue;
> + if (p->start <= addr && (p->end >= addr + size - 1))
> + continue;
> + printk(KERN_WARNING "resource map sanity check conflict "
> + " 0x%llx 0x%llx 0x%llx 0x%llx %s\n",
> + addr, addr + size - 1, p->start, p->end, p->name);
> + err = -1;
> + break;
> + }
> + read_unlock(&resource_lock);
> +
> + return err;
J
--
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