lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 May 2015 15:47:16 -0700
From:	Dan Williams <dan.j.williams@...el.com>
To:	Ross Zwisler <ross.zwisler@...ux.intel.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Linux ACPI <linux-acpi@...r.kernel.org>,
	"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
Subject: Re: [PATCH 1/6] pmem: add force casts to avoid __iomem annotation

On Thu, May 28, 2015 at 3:35 PM, Ross Zwisler
<ross.zwisler@...ux.intel.com> wrote:
> Even though we use ioremap_nocache() to map our persistent memory in the
> pmem driver, the memory we are mapping behaves like normal memory and
> not I/O memory in that it can be accessed using regular memcpy()
> operations and doesn't need to go through memcpy_toio() and
> memcpy_fromio().  Force casting the pointers received from
> ioremap_nocache() and given to iounmap() gives us the correct behavior
> and makes sparse happy.
>
> Signed-off-by: Ross Zwisler <ross.zwisler@...ux.intel.com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: linux-nvdimm@...ts.01.org
> ---
>  drivers/block/nd/pmem.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/nd/pmem.c b/drivers/block/nd/pmem.c
> index 5e8c9c629f22..a8712e41e7f5 100644
> --- a/drivers/block/nd/pmem.c
> +++ b/drivers/block/nd/pmem.c
> @@ -163,7 +163,8 @@ static struct pmem_device *pmem_alloc(struct device *dev, struct resource *res,
>          * of the CPU caches in case of a crash.
>          */
>         err = -ENOMEM;
> -       pmem->virt_addr = ioremap_nocache(pmem->phys_addr, pmem->size);
> +       pmem->virt_addr = (__force void *)ioremap_nocache(pmem->phys_addr,
> +                       pmem->size);

I think I'd rather see casting when ->virt_addr is used (the
__io_virt() helper can be used to make this a tad cleaner), or provide
ioremap apis that don't attach __iomem to their return value.  Because
in this and other cases ioremap() is being on non "i/o" memory.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ