git: df3d0c0d0d04 - stable/12 - Declare packed struct ata_params as 2-byte-aligned
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Mar 2023 22:28:31 UTC
The branch stable/12 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=df3d0c0d0d0440e5fdc3b8fe0696269ca01f6476
commit df3d0c0d0d0440e5fdc3b8fe0696269ca01f6476
Author: Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2019-12-21 02:44:00 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-03-22 15:12:16 +0000
Declare packed struct ata_params as 2-byte-aligned
This avoids gcc9 warning about unaligned access to the structure when
casting to uint16_t pointer type.
Submitted by: imp
Reviewed by: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22888
(cherry picked from commit 36947e1f4deacec2a88bba226e9b46efebe8655e)
---
sbin/camcontrol/camcontrol.c | 2 +-
sys/sys/ata.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index a91aa4779822..63749da3ae1c 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -2374,7 +2374,7 @@ ataidentify(struct cam_device *device, int retry_count, int timeout)
if (arglist & CAM_ARG_VERBOSE) {
printf("%s%d: Raw identify data:\n",
device->device_name, device->dev_unit_num);
- dump_data((void*)ident_buf, sizeof(struct ata_params));
+ dump_data((uint16_t *)ident_buf, sizeof(struct ata_params));
}
if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) {
diff --git a/sys/sys/ata.h b/sys/sys/ata.h
index 6aa1695e564f..0187efaacc54 100644
--- a/sys/sys/ata.h
+++ b/sys/sys/ata.h
@@ -313,7 +313,7 @@ struct ata_params {
/*223*/ u_int16_t transport_minor;
u_int16_t reserved224[31];
/*255*/ u_int16_t integrity;
-} __packed;
+} __packed __aligned(2);
/* ATA Dataset Management */
#define ATA_DSM_BLK_SIZE 512