From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F63C433DF for ; Fri, 7 Aug 2020 09:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 896B3221E5 for ; Fri, 7 Aug 2020 09:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728113AbgHGJip convert rfc822-to-8bit (ORCPT ); Fri, 7 Aug 2020 05:38:45 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:30485 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727912AbgHGJin (ORCPT ); Fri, 7 Aug 2020 05:38:43 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-16-5qKKb2pWNfK428LdGWcIog-1; Fri, 07 Aug 2020 10:38:39 +0100 X-MC-Unique: 5qKKb2pWNfK428LdGWcIog-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 7 Aug 2020 10:38:38 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 7 Aug 2020 10:38:38 +0100 From: David Laight To: 'Christoph Hellwig' , "x86@kernel.org" , "Jan Kara" CC: "linux-arm-kernel@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , "linux-arch@vger.kernel.org" , Jan Kara Subject: RE: [PATCH 3/3] quota: simplify the quotactl compat handling Thread-Topic: [PATCH 3/3] quota: simplify the quotactl compat handling Thread-Index: AQHWZzVGHzqazLGYN0OsEvz6unAGWaksbb8Q Date: Fri, 7 Aug 2020 09:38:38 +0000 Message-ID: References: <20200731122202.213333-1-hch@lst.de> <20200731122202.213333-4-hch@lst.de> In-Reply-To: <20200731122202.213333-4-hch@lst.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Christoph Hellwig > Sent: 31 July 2020 13:22 > > Fold the misaligned u64 workarounds into the main quotactl flow instead > of implementing a separate compat syscall handler. > ... > +static int compat_copy_fs_quota_stat(struct compat_fs_quota_stat __user *to, > + struct fs_quota_stat *from) > +{ > + if (put_user(from->qs_version, &to->qs_version) || > + put_user(from->qs_flags, &to->qs_flags) || > + put_user(from->qs_pad, &to->qs_pad) || > + compat_copy_fs_qfilestat(&to->qs_uquota, &from->qs_uquota) || > + compat_copy_fs_qfilestat(&to->qs_gquota, &from->qs_gquota) || > + put_user(from->qs_incoredqs, &to->qs_incoredqs) || > + put_user(from->qs_btimelimit, &to->qs_btimelimit) || > + put_user(from->qs_itimelimit, &to->qs_itimelimit) || > + put_user(from->qs_rtbtimelimit, &to->qs_rtbtimelimit) || > + put_user(from->qs_bwarnlimit, &to->qs_bwarnlimit) || > + put_user(from->qs_iwarnlimit, &to->qs_iwarnlimit)) > + return -EFAULT; > + return 0; > +} That might look better as a 'noinline' function that copied all the fields into an on-stack struct compat_fs_quota_stat and then did a single copy_to_user(). (I do 'like' qs_pad - I wonder what the person who added it was smoking.) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)