From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9zjL-0000Bp-I9 for qemu-devel@nongnu.org; Mon, 06 Jun 2016 14:58:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9zjJ-0003nv-GC for qemu-devel@nongnu.org; Mon, 06 Jun 2016 14:58:30 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57561) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9zjJ-0003np-9D for qemu-devel@nongnu.org; Mon, 06 Jun 2016 14:58:29 -0400 From: Peter Maydell Date: Mon, 6 Jun 2016 19:58:16 +0100 Message-Id: <1465239499-5048-16-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> References: <1465239499-5048-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 15/18] linux-user: Correct signedness of target_flock l_start and l_len fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Laurent Vivier The l_start and l_len fields in the various target_flock structures are supposed to be '__kernel_off_t' or '__kernel_loff_t', which means they should be signed, not unsigned. Correcting the structure definitions means that __get_user() and __put_user() will correctly sign extend them if the guest is using 32 bit offsets and the host is using 64 bit offsets. This fixes failures in the LTP 'fcntl14' tests where it checks that negative seek offsets work correctly. We reindent the structures to drop hard tabs since we're touching 40% of the fields anyway. Signed-off-by: Peter Maydell --- linux-user/syscall_defs.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 124754f..8a801e0 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2289,34 +2289,34 @@ struct target_statfs64 { #endif struct target_flock { - short l_type; - short l_whence; - abi_ulong l_start; - abi_ulong l_len; - int l_pid; + short l_type; + short l_whence; + abi_long l_start; + abi_long l_len; + int l_pid; }; struct target_flock64 { - short l_type; - short l_whence; + short l_type; + short l_whence; #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) \ || defined(TARGET_SPARC) || defined(TARGET_HPPA) \ || defined(TARGET_MICROBLAZE) || defined(TARGET_TILEGX) - int __pad; + int __pad; #endif - unsigned long long l_start; - unsigned long long l_len; - int l_pid; + long long l_start; + long long l_len; + int l_pid; } QEMU_PACKED; #ifdef TARGET_ARM struct target_eabi_flock64 { - short l_type; - short l_whence; - int __pad; - unsigned long long l_start; - unsigned long long l_len; - int l_pid; + short l_type; + short l_whence; + int __pad; + long long l_start; + long long l_len; + int l_pid; } QEMU_PACKED; #endif -- 1.9.1