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] [day] [month] [year] [list]
Message-ID: <20090217215535.GA11336@elte.hu>
Date:	Tue, 17 Feb 2009 22:55:35 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	James Bottomley <James.Bottomley@...senPartnership.com>
Cc:	hpa@...or.com, mingo@...hat.com, tglx@...utronix.de,
	hpa@...ux.intel.com, linux-kernel@...r.kernel.org,
	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/headers] x86: truncate ISA addresses to unsigned int


* James Bottomley <James.Bottomley@...senPartnership.com> wrote:

> On Tue, 2009-02-17 at 21:12 +0000, H. Peter Anvin wrote:
> > Author:     H. Peter Anvin <hpa@...ux.intel.com>
> > AuthorDate: Tue, 17 Feb 2009 13:01:51 -0800
> > Commit:     H. Peter Anvin <hpa@...ux.intel.com>
> > CommitDate: Tue, 17 Feb 2009 13:01:51 -0800
> > 
> > x86: truncate ISA addresses to unsigned int
> > 
> > Impact: Cleanup; fix inappropriate macro use
> > 
> > ISA addresses on x86 are mapped 1:1 with the physical address space.
> > Since the ISA address space is only 24 bits (32 for VLB or LPC) it
> > will always fit in an unsigned int, and at least in the aha1542 driver
> > using a wider type would cause an undesirable promotion.  Hence
> > explicitly cast the ISA bus addresses to unsigned int.
> > 
> > Signed-off-by: H. Peter Anvin <hpa@...ux.intel.com>
> > Cc: James Bottomley <James.Bottomley@...senpartnership.com>
> > 
> > 
> > ---
> >  arch/x86/include/asm/io.h |   11 ++++++++---
> >  1 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> > index 4f8e820..683d0b4 100644
> > --- a/arch/x86/include/asm/io.h
> > +++ b/arch/x86/include/asm/io.h
> > @@ -124,10 +124,15 @@ static inline void *phys_to_virt(phys_addr_t address)
> >  
> >  /*
> >   * ISA I/O bus memory addresses are 1:1 with the physical address.
> > + * However, we truncate the address to unsigned int to avoid undesirable
> > + * promitions in legacy drivers.
> >   */
> > -#define isa_virt_to_bus (unsigned long)virt_to_phys
> > -#define isa_page_to_bus page_to_phys
> > -#define isa_bus_to_virt phys_to_virt
> > +static inline unsigned int isa_virt_to_bus(volatile void *address)
> 
> The rest looks fine, but why is the address volatile?  The macro below
> never actually dereferences it.

That is because the volatile keyword here broadens the permitted 
_input_ type.

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