mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
md driver compat32: fix structure padding for arm, powerpc
Because the 32-bit md_ioctl structure contains 64-bit members, arm and powerpc add padding to a multiple of 8. i386 doesn't do this. The md_ioctl32 definition was correct for amd64/i386 without padding, but wrong for arm64 and powerpc64. Make __packed__ conditional on __amd64__, and test for the expected size on non-amd64. Note that mdconfig is used in the ATF test suite. Note, I verified the structure size for powerpc, but was unable to test. MFC after: 1 week Reviewed by: jrtc27 Differential Revision: https://reviews.freebsd.org/D41339 Discussed with: jhibbits
This commit is contained in:
parent
ddefad7c4f
commit
58a46cfd75
1 changed files with 9 additions and 1 deletions
|
|
@ -147,8 +147,16 @@ struct md_ioctl32 {
|
|||
int md_fwsectors;
|
||||
uint32_t md_label;
|
||||
int md_pad[MDNPAD];
|
||||
} __attribute__((__packed__));
|
||||
}
|
||||
#ifdef __amd64__
|
||||
__attribute__((__packed__))
|
||||
#endif
|
||||
;
|
||||
#ifndef __amd64__
|
||||
CTASSERT((sizeof(struct md_ioctl32)) == 440);
|
||||
#else
|
||||
CTASSERT((sizeof(struct md_ioctl32)) == 436);
|
||||
#endif
|
||||
|
||||
#define MDIOCATTACH_32 _IOC_NEWTYPE(MDIOCATTACH, struct md_ioctl32)
|
||||
#define MDIOCDETACH_32 _IOC_NEWTYPE(MDIOCDETACH, struct md_ioctl32)
|
||||
|
|
|
|||
Loading…
Reference in a new issue