Date: Sat, 24 Apr 1999 15:30:26 +0100 (BST) From: Doug Rabson <dfr@nlsystems.com> To: KATO Takenori <kato@ganko.eps.nagoya-u.ac.jp> Cc: current@freebsd.org Subject: Re: singed short to unsigned long conversion problem in isa.c Message-ID: <Pine.BSF.4.05.9904241528531.28665-100000@herring.nlsystems.com> In-Reply-To: <19990424210206R.kato@gneiss.eps.nagoya-u.ac.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 24 Apr 1999, KATO Takenori wrote:
> The type of the member id_port in isa_device structure is signed short
> and a value is converted int unsigned long to allocate I/O port
> resource via bus_alloc_resources. If an I/O port >= 0x8000,
> conversion from signed short to unsigned long causes unexpected result
> and nexus_alloc_resouce cannot allocate resouce.
>
> Fix is:
>
> ---------- BEGIN ----------
> *** isa.c.orig Sat Apr 24 20:55:32 1999
> --- isa.c Sat Apr 24 20:55:24 1999
> ***************
> *** 75,81 ****
> * The structure used to attach devices to the isa bus.
> */
> struct isa_device {
> ! short id_port[ISA_NPORT_IVARS];
> u_short id_portsize[ISA_NPORT_IVARS];
> vm_offset_t id_maddr[ISA_NMEM_IVARS];
> vm_size_t id_msize[ISA_NMEM_IVARS];
> --- 75,81 ----
> * The structure used to attach devices to the isa bus.
> */
> struct isa_device {
> ! u_short id_port[ISA_NPORT_IVARS];
> u_short id_portsize[ISA_NPORT_IVARS];
> vm_offset_t id_maddr[ISA_NMEM_IVARS];
> vm_size_t id_msize[ISA_NMEM_IVARS];
> ---------- END ----------
>
> If this should not be in sys/i386/isa, I will copy this file into
> sys/pc98/pc98. Comment please.
It needs to be signed since the value -1 is used to indicate no port
resources. Perhaps it would be better to change it to 'int' instead of
'u_short'.
--
Doug Rabson Mail: dfr@nlsystems.com
Nonlinear Systems Ltd. Phone: +44 181 442 9037
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9904241528531.28665-100000>
