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:	Sat, 26 Feb 2011 14:16:09 +0100
From:	Arnd Bergmann <arnd@...db.de>
To:	"Guan Xuetao" <gxt@...c.pku.edu.cn>
Cc:	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
	"'Greg KH'" <greg@...ah.com>
Subject: Re: [PATCH 09/12] unicore32 machine related files: hardware registers

On Saturday 26 February 2011, Guan Xuetao wrote:
> > >  #ifndef __ASSEMBLY__
> > >
> > > -# define __REG(x)      (*((volatile unsigned long *)io_p2v(x)))
> > > -# define __PREG(x)     (io_v2p((unsigned long)&(x)))
> > > +# define __REG(x)      (void __iomem *)io_p2v(x)
> > 
> > The patch looks correct, but if you make the the definition for
> > PKUNITY_MMIO_BASE contain the cast to (void __iomem *), you no
> > longer need another cast.
>
> Because the io_p2v(x) calculate x and PKUNITY_IOSPACE_BASE,
> all registers should be added with (void __iomem *).
> So I prefer to remain the previous patch.

The problem with the definition of io_p2v is that it gives you
an type that is impossible to use correctly, except in assembly
code. Linux assumes that MMIO registers in virtual space
are __iomem pointers, and we like that to be consistent.

If you have a function that returns a virtual address, it should
really have the same type as any other function that uses a virtual
address.

	Arnd
--
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