Skip to contentSkip to conversation

linux-user: Use target abi_int type for pipefd[1] in pipe()

PATCH Applied Helge Deller 3 participants 3 messages Jul 17, 2022 – Jul 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Use target abi_int type for pipefd[1] in pipe()

When writing back the fd[1] pipe file handle to emulated userspace memory, use sizeof(abi_int) as offset insted of the hosts's int type. There is no functional change in this patch.

linux-user/syscall.c +1 -1
index 991b85e6b4..1e6e814871 100644
@@ -1624,7 +1624,7 @@ static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes,
     }
 
     if (put_user_s32(host_pipe[0], pipedes)
-        || put_user_s32(host_pipe[1], pipedes + sizeof(host_pipe[0])))
+        || put_user_s32(host_pipe[1], pipedes + sizeof(abi_int)))
         return -TARGET_EFAULT;
     return get_errno(ret);
 }
#2 lore raw
In reply to Helge Deller

Le 17/07/2022 à 18:21, Helge Deller a écrit :

Quoted 12 lines

When writing back the fd[1] pipe file handle to emulated userspace memory, use sizeof(abi_int) as offset insted of the hosts's int type. There is no functional change in this patch.

linux-user/syscall.c +0 -0
index 991b85e6b4..1e6e814871 100644

linux-user/syscall.c static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes, · line 1630

Quoted 8 lines
linux-user/syscall.c +1 -1
@@ -1624,7 +1624,7 @@ static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes,
      }
 
      if (put_user_s32(host_pipe[0], pipedes)
-        || put_user_s32(host_pipe[1], pipedes + sizeof(host_pipe[0])))
+        || put_user_s32(host_pipe[1], pipedes + sizeof(abi_int)))
          return -TARGET_EFAULT;
      return get_errno(ret);
  }

Applied to my linux-user-for-7.1 branch.

Thanks,
Laurent