git: ebcfab998e63 - main - nvme: Explicitly align struct nvme_command on an 8 byte boundary
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 08 May 2024 23:05:54 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ebcfab998e631fa7e29e1c0694868d745fc085ee commit ebcfab998e631fa7e29e1c0694868d745fc085ee Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-05-08 23:05:39 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-05-08 23:05:39 +0000 nvme: Explicitly align struct nvme_command on an 8 byte boundary This was already true for most architectures due to uint64_t structure members. However, i386 is special in that it only requires 4 byte alignment for uint64_t. As a result, casts from struct nvme_command to struct nvmf_fabric_cmd were raising a "cast increases alignment" warning on i386. Explicitly aligning struct nvme_command pacifies this warning on i386. Reported by: rscheff Sponsored by: Chelsio Communications --- sys/dev/nvme/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 6ef7a2bd8aad..bca4df92cb25 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -832,7 +832,7 @@ struct nvme_command { uint32_t cdw13; /* command-specific */ uint32_t cdw14; /* command-specific */ uint32_t cdw15; /* command-specific */ -}; +} __aligned(8); _Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command");