linux-user: fix matching ioctl numbers in print_ioctl
target_cmd in struct IOCTLEntry is a signed int. Make sure the ioctl cmd argument in the syscall is converted to int when matching, so that it works correctly with an ioctl cmd that has bit 31 set. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Helge Deller <deller@gmx.de> Signed-off-by: Helge Deller <deller@gmx.de>
Andreas Schwab committed
Feb 10, 2026 at 10:46 UTC
e47b1ffff92b62a32838b39e8512e69a225ed200
1 file changed
+3
-3
linux-user/strace.c
+3
-3
@@ -1021,12 +1021,12 @@ print_syscall_ret_ioctl(CPUArchState *cpu_env, const struct syscallname *name,
1021
int target_size;
1022
1023
for (ie = ioctl_entries; ie->target_cmd != 0; ie++) {
1024
- if (ie->target_cmd == arg1) {
1024
+ if (ie->target_cmd == (int)arg1) {
1025
break;
1026
}
1027
}
1028
1029
- if (ie->target_cmd == arg1 &&
1029
+ if (ie->target_cmd == (int)arg1 &&
1030
(ie->access == IOC_R || ie->access == IOC_RW)) {
1031
arg_type = ie->arg_type;
1032
qemu_log(" (");
@@ -4359,7 +4359,7 @@ print_ioctl(CPUArchState *cpu_env, const struct syscallname *name,
4359
int target_size;
4360
4361
for (ie = ioctl_entries; ie->target_cmd != 0; ie++) {
4362
- if (ie->target_cmd == arg1) {
4362
+ if (ie->target_cmd == (int)arg1) {
4363
break;
4364
}
4365
}