[RFC,12/34] hurd: More 64-bit integer casting fixes

Message ID 20230319151017.531737-13-bugaevc@gmail.com
State Committed, archived
Headers
Series The rest of the x86_64-gnu port |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Sergey Bugaev March 19, 2023, 3:09 p.m. UTC
  Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
 sysdeps/mach/hurd/ioctl.c          | 4 ++--
 sysdeps/mach/hurd/x86/init-first.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Samuel Thibault April 2, 2023, 11:03 p.m. UTC | #1
Applied, thanks!

Sergey Bugaev, le dim. 19 mars 2023 18:09:55 +0300, a ecrit:
> Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
> ---
>  sysdeps/mach/hurd/ioctl.c          | 4 ++--
>  sysdeps/mach/hurd/x86/init-first.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
> index 0f5de5d3..ab913a59 100644
> --- a/sysdeps/mach/hurd/ioctl.c
> +++ b/sysdeps/mach/hurd/ioctl.c
> @@ -149,10 +149,10 @@ __ioctl (int fd, unsigned long int request, ...)
>  	     Rather than pointing to the value, ARG is the value itself.  */
>  #ifdef MACH_MSG_TYPE_BIT
>  	  *t++ = io2mach_type (1, _IOTS (integer_t));
> -	  *(integer_t *) t = (integer_t) arg;
> +	  *(integer_t *) t = (integer_t) (intptr_t) arg;
>  	  t = (void *) t + sizeof (integer_t);
>  #else
> -	  *(integer_t *) p = (integer_t) arg;
> +	  *(integer_t *) p = (integer_t) (intptr_t) arg;
>  	  p = (void *) p + sizeof (integer_t);
>  #endif
>  	}
> diff --git a/sysdeps/mach/hurd/x86/init-first.c b/sysdeps/mach/hurd/x86/init-first.c
> index 6ca27155..48c330ec 100644
> --- a/sysdeps/mach/hurd/x86/init-first.c
> +++ b/sysdeps/mach/hurd/x86/init-first.c
> @@ -1,4 +1,4 @@
> -/* Initialization code run first thing by the ELF startup code.  For i386/Hurd.
> +/* Initialization code run first thing by the ELF startup code.  For x86/Hurd.
>     Copyright (C) 1995-2023 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
> @@ -92,7 +92,7 @@ posixland_init (int argc, char **argv, char **envp)
>  static void
>  init (void **data)
>  {
> -  int argc = (int) *data;
> +  int argc = (int) (uintptr_t) *data;
>    char **argv = (void *) (data + 1);
>    char **envp = &argv[argc + 1];
>    struct hurd_startup_data *d;
> -- 
> 2.39.2
>
  

Patch

diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 0f5de5d3..ab913a59 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -149,10 +149,10 @@  __ioctl (int fd, unsigned long int request, ...)
 	     Rather than pointing to the value, ARG is the value itself.  */
 #ifdef MACH_MSG_TYPE_BIT
 	  *t++ = io2mach_type (1, _IOTS (integer_t));
-	  *(integer_t *) t = (integer_t) arg;
+	  *(integer_t *) t = (integer_t) (intptr_t) arg;
 	  t = (void *) t + sizeof (integer_t);
 #else
-	  *(integer_t *) p = (integer_t) arg;
+	  *(integer_t *) p = (integer_t) (intptr_t) arg;
 	  p = (void *) p + sizeof (integer_t);
 #endif
 	}
diff --git a/sysdeps/mach/hurd/x86/init-first.c b/sysdeps/mach/hurd/x86/init-first.c
index 6ca27155..48c330ec 100644
--- a/sysdeps/mach/hurd/x86/init-first.c
+++ b/sysdeps/mach/hurd/x86/init-first.c
@@ -1,4 +1,4 @@ 
-/* Initialization code run first thing by the ELF startup code.  For i386/Hurd.
+/* Initialization code run first thing by the ELF startup code.  For x86/Hurd.
    Copyright (C) 1995-2023 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -92,7 +92,7 @@  posixland_init (int argc, char **argv, char **envp)
 static void
 init (void **data)
 {
-  int argc = (int) *data;
+  int argc = (int) (uintptr_t) *data;
   char **argv = (void *) (data + 1);
   char **envp = &argv[argc + 1];
   struct hurd_startup_data *d;