From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGVpf-0005E4-6i for qemu-devel@nongnu.org; Tue, 25 Sep 2012 10:09:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGVpb-0003wo-0Q for qemu-devel@nongnu.org; Tue, 25 Sep 2012 10:09:51 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:47431) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGVpa-0003wJ-Qo for qemu-devel@nongnu.org; Tue, 25 Sep 2012 10:09:46 -0400 Received: from eusync2.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MAW00JI3SP42R00@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Tue, 25 Sep 2012 15:10:16 +0100 (BST) Received: from [106.116.147.46] by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MAW004GFSO5AH10@eusync2.samsung.com> for qemu-devel@nongnu.org; Tue, 25 Sep 2012 15:09:41 +0100 (BST) Message-id: <5061BB33.7000009@samsung.com> Date: Tue, 25 Sep 2012 16:09:55 +0200 From: Karol Lewandowski MIME-version: 1.0 References: <1348067345-13633-1-git-send-email-k.lewandowsk@samsung.com> In-reply-to: Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] linux-user: Add naive implementation of capget() syscall List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: riku.voipio@iki.fi, qemu-devel@nongnu.org On 09/22/2012 02:07 PM, Blue Swirl wrote: Hi! >> +static int sys_capget(struct __user_cap_header_struct *hdr, struct __user_cap_data_struct *data) >> +{ >> + return (capget(hdr, data)); > > This is not correct. The structure needs to be converted field by > field to host native format, especially endianness. Right, that was too naive. :) > The parenthesis aren't useful. Will drop those. >> +} >> + >> #ifdef CONFIG_ATFILE >> /* >> * Host system seems to have atfile syscall stubs available. We >> @@ -7436,7 +7443,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, >> unlock_user(p, arg1, ret); >> break;106.116.62.75 >> case TARGET_NR_capget: >> - goto unimplemented; >> + { >> + void *p2 = NULL; >> + if (!(p = lock_user(VERIFY_WRITE, arg1, sizeof(struct __user_cap_header_struct), 0))) >> + goto efault; > > Here and below you also assume that host structure size matches guest. Hmm, all the fields in these structures are __u32 but one. Will fix that. > Missing braces, please read CODING_STYLE and use checkpatch.pl. Ok, good. Thanks a lot for review! Regards, -- Karol Lewandowski | Samsung Poland R&D Center | Linux/Platform