ebabcd5c79
Update to 4.3 and add gating test Resolves: RHEL-30530 Signed-off-by: Xiao Ni <xni@redhat.com>
63 lines
2.4 KiB
Diff
63 lines
2.4 KiB
Diff
From c5879860eac64ddd7bec4ba50c9adbfebcbf1d2e Mon Sep 17 00:00:00 2001
|
||
From: Blazej Kucman <blazej.kucman@intel.com>
|
||
Date: Wed, 15 May 2024 13:26:28 +0200
|
||
Subject: [PATCH 1/1] mdadm: Fix compilation for 32-bit arch
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Casting void pointer to __u64 works for 64-bit arch but fails to compile
|
||
on 32-bit arch like i686.
|
||
|
||
Fail on i686 platform:
|
||
drive_encryption.c: In function ‘nvme_security_recv_ioctl’:
|
||
drive_encryption.c:236:25: error: cast from pointer to integer of
|
||
different size [-Werror=pointer-to-int-cast]
|
||
236 | nvme_cmd.addr = (__u64)response_buffer;
|
||
| ^
|
||
drive_encryption.c: In function ‘nvme_identify_ioctl’:
|
||
drive_encryption.c:271:25: error: cast from pointer to integer of
|
||
different size [-Werror=pointer-to-int-cast]
|
||
271 | nvme_cmd.addr = (__u64)response_buffer;
|
||
| ^
|
||
cc1: all warnings being treated as errors
|
||
make: *** [Makefile:211: drive_encryption.o] Error 1
|
||
|
||
This change adds cast void pointer to uintptr_t first to ensure that
|
||
proper pointer size is used for casting from pointer type. Then is safe to
|
||
cast it to __u64 because it is tracked as u_int, regardless it is 32-bit
|
||
or 64-bit arch.
|
||
|
||
Reported-by: Xiao Ni <xni@redhat.com>
|
||
Fixes: cc48406887b3 ("Add reading Opal NVMe encryption information")
|
||
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
|
||
---
|
||
drive_encryption.c | 4 ++--
|
||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||
|
||
diff --git a/drive_encryption.c b/drive_encryption.c
|
||
index 27da9621..a4ad799f 100644
|
||
--- a/drive_encryption.c
|
||
+++ b/drive_encryption.c
|
||
@@ -233,7 +233,7 @@ nvme_security_recv_ioctl(int disk_fd, __u8 sec_protocol, __u16 comm_id, void *re
|
||
nvme_cmd.cdw10 = sec_protocol << 24 | comm_id << 8;
|
||
nvme_cmd.cdw11 = buf_size;
|
||
nvme_cmd.data_len = buf_size;
|
||
- nvme_cmd.addr = (__u64)response_buffer;
|
||
+ nvme_cmd.addr = (__u64)(uintptr_t)response_buffer;
|
||
|
||
status = ioctl(disk_fd, NVME_IOCTL_ADMIN_CMD, &nvme_cmd);
|
||
if (status != 0) {
|
||
@@ -268,7 +268,7 @@ nvme_identify_ioctl(int disk_fd, void *response_buffer, size_t buf_size, const i
|
||
nvme_cmd.opcode = NVME_IDENTIFY;
|
||
nvme_cmd.cdw10 = NVME_IDENTIFY_CONTROLLER_DATA;
|
||
nvme_cmd.data_len = buf_size;
|
||
- nvme_cmd.addr = (__u64)response_buffer;
|
||
+ nvme_cmd.addr = (__u64)(uintptr_t)response_buffer;
|
||
|
||
status = ioctl(disk_fd, NVME_IOCTL_ADMIN_CMD, &nvme_cmd);
|
||
if (status != 0) {
|
||
--
|
||
2.41.0
|
||
|