NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/48550: panic when accessing CDs
The following reply was made to PR kern/48550; it has been noted by GNATS.
From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: kern/48550: panic when accessing CDs
Date: Wed, 19 Mar 2014 19:00:59 +0000
On Wed, Mar 19, 2014 at 03:45:00PM +0000, Martin Husemann wrote:
...
> As henning petersen pointed out in 48664, this is a side effect of gcc 4.8.
> Actually it turns out that the scsipi_read_cd_cap_data structure is
> misaligned on the stack (as it formally requires no alignement) by newer
> gcc and scsipi_command() doesn't seem to like this.
>
> This patch avoids that and makes the READ_CD_CAPACITY work:
>
> --8<--
> Index: scsipi_cd.h
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/scsipi/scsipi_cd.h,v
> retrieving revision 1.21
> diff -u -r1.21 scsipi_cd.h
> --- scsipi_cd.h 1 Apr 2009 12:19:04 -0000 1.21
> +++ scsipi_cd.h 19 Mar 2014 15:35:33 -0000
> @@ -285,7 +285,7 @@
> struct scsipi_read_cd_cap_data {
> u_int8_t addr[4];
> u_int8_t length[4];
> -} __packed;
> +} __packed __aligned(4);
ISTM that it might be worth removing the __packed and replacing
the two fields with uint32_t - and then accessing with the correct
endianness.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index