Skip to content

Commit

Permalink
incus: apply upstream patch for 32bit
Browse files Browse the repository at this point in the history
  • Loading branch information
dkwo committed Nov 19, 2024
1 parent bf86f50 commit 912f409
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From afa91aaa5d0f7c95a69a17428e1974ebbf34ecdf Mon Sep 17 00:00:00 2001
From: Christian Brauner <brauner@kernel.org>
Date: Tue, 19 Nov 2024 15:42:18 +0100
Subject: [PATCH] cgo/process_utils: fix 32bit builds

New clang-14 reports errors for directly casting from an integer to a
pointer. Use uintptr_t to fix that problem and adhere to the casting
rules.

Fixes: https://github.com/lxc/incus/issues/1395
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
shared/cgo/process_utils.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/shared/cgo/process_utils.h b/shared/cgo/process_utils.h
index 3e1c400c539..19443e921fa 100644
--- a/shared/cgo/process_utils.h
+++ b/shared/cgo/process_utils.h
@@ -219,9 +219,11 @@ static inline int setproctitle(char *title)
ret = prctl(PR_SET_MM, prctl_arg(PR_SET_MM_MAP), prctl_arg(&prctl_map),
prctl_arg(sizeof(prctl_map)), prctl_arg(0));
if (ret == 0) {
- char *dest = (char *)arg_start;
+ char *dest;
+
+ dest = (char *)(uintptr_t)arg_start;
memcpy(dest, title, len - 1);
- dest[len-1] = '\0';
+ dest[len - 1] = '\0';
}

return ret;

0 comments on commit 912f409

Please sign in to comment.