Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1828213ybn; Thu, 26 Sep 2019 02:51:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfPKoYKfOQV6Q2fKTujK8qGSt1I82Wtcz/OGuaU30sug/VbaCaZLK2ElF3PKDlStr/sKQI X-Received: by 2002:a05:6402:1212:: with SMTP id c18mr2519957edw.259.1569491516072; Thu, 26 Sep 2019 02:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569491516; cv=none; d=google.com; s=arc-20160816; b=gXkyS6JE3nG83BkE4O1xNBLOz4oK+0J8OMgKOpTeQbRC9noKM6Ccr1h/bMTUBevpPB zqzBI1rdZMT18h9eI2BsWOvgps+MxBj0gOJYrhOyeITe74KLhfNMX6FrQyiK/9YlnE7i GJRMF9rD3inC5Z3t6KWY4XvPbVb7LdGdHi+VHd59z/wZu+nOAV/gj1VXWwfgKqRi5JEX VqHadvTOnR94mpwgd438aEJbYcLEQDfhSJ91uUMKa9krjymG27CE7NlPljqhFkJFoh6D gildaYhw0T5CqGmWFWqS7Kgz9bvZWwaNp7y1uLnB5ZmgGCQCmPVXlZtmkGnhxVW9nBN5 5LzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qRbAjoylre9NlfBO8BTIZTcAtpx4/BimOoVlxjcab3A=; b=LCAHcS01SyzfE8eg/nt5CM9N+MGXSpMVAZbaK5SSouZZkJuC30qwaxwgPACxS+l/57 5J0vXnTcPiNGYkrzhaSLBqaZsOCj3UzG1Ettf7uDxBj3kB4jNzR3Tmv/WhYJCJi8YSIZ UhjWF7tkL5G4s28AIJJPZYpPMH7z5oa6kJSJ02dX47k1hn8zyJSSoQfUr+ouS6g7Yu4r 9GqsWLbg08t16n5P2Wb7B0MsRu8UC1tAiAOrnKvU8q7qzsVbfiW5H4+o1cQVIcZF6Ret UNAKgzn0mRiiPBkgWXE+Z72iTpeuVJSJ0KOwKXePGtnBXQQf9OXLYq8X8eSKWHb010Zi Yr8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RgsNfscz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si861988edd.447.2019.09.26.02.51.33; Thu, 26 Sep 2019 02:51:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RgsNfscz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408221AbfIYSNk (ORCPT + 99 others); Wed, 25 Sep 2019 14:13:40 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36072 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407511AbfIYSNj (ORCPT ); Wed, 25 Sep 2019 14:13:39 -0400 Received: by mail-lj1-f193.google.com with SMTP id v24so6680690ljj.3 for ; Wed, 25 Sep 2019 11:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qRbAjoylre9NlfBO8BTIZTcAtpx4/BimOoVlxjcab3A=; b=RgsNfsczHYhjvCLBROtPtLM/H6+B+uvZ0JZAmKUTL8vx5b+5Msq9BuI/ssv3TZeicD ZroPWSJXfD63y6d4x0mq/4x/A34lOMaYIBNZCaVCrazpWITBqw+LjtY7dX6fRMKxbco1 5Q4v89fff+oZ1ZC0vffbhrIPOES+t8XyK7sRo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qRbAjoylre9NlfBO8BTIZTcAtpx4/BimOoVlxjcab3A=; b=aZEjDttnuxPvswAgHEE4TBD5Q1/sdUqTZBzeTwOdKpyv1PNi0OhTgjga4g2geCEmMP S2r0f47XlF5HYuTFRVNMwyC0n7pNxIVL7ZjfwvGxjTpgkhyY5nBOM9CUyh+ERQr9zfiJ 29izKQHsI69wishDgAUoi5wsI7RTcEGGb23J3JIEMat7OpYDOCHDtxI1VGjhlkVD6jYN 1IiQS4RjyBGT64jIEGS4UGXCBqxmhzCUJUI2jvfw1Ik2INySWHapEthUvQOiYhLJ9bho 6hu6eNkJKspKm8OQ4jxbPv/Jy+4vR6irKc3DP1blWhtcn57mUSKJV8AYeOYRdA/8vqMJ f+Dg== X-Gm-Message-State: APjAAAU5kHi/b0LDUAFSCZCe0RvLHttzLRam6CKL0KJWs33L3zQJz5Oq zSmCByzQEYYPMiX2MS4EwTVZafkmy3o= X-Received: by 2002:a2e:9a88:: with SMTP id p8mr7245276lji.86.1569435216614; Wed, 25 Sep 2019 11:13:36 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id b7sm1286819lfp.23.2019.09.25.11.13.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Sep 2019 11:13:34 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id m13so6647515ljj.11 for ; Wed, 25 Sep 2019 11:13:34 -0700 (PDT) X-Received: by 2002:a2e:8789:: with SMTP id n9mr7476687lji.52.1569435214002; Wed, 25 Sep 2019 11:13:34 -0700 (PDT) MIME-Version: 1.0 References: <20190925165915.8135-1-cyphar@cyphar.com> <20190925165915.8135-2-cyphar@cyphar.com> <20190925172049.skm6ohnnxpofdkzv@yavin> <20190925180412.GK26530@ZenIV.linux.org.uk> In-Reply-To: <20190925180412.GK26530@ZenIV.linux.org.uk> From: Linus Torvalds Date: Wed, 25 Sep 2019 11:13:18 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper To: Al Viro Cc: Aleksa Sarai , Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Christian Brauner , Rasmus Villemoes , GNU C Library , Linux API , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 25, 2019 at 11:04 AM Al Viro wrote: > > IMO it's better to lift reading the first word out of the loop, like this: > ... > Do you see any problems with that variant? That looks fine to me too. It's a bit harder for humans to read because of how it reads the word from user space one iteration early, but from a code generation standpoint it probably is better. So slightly subtler source code, and imho harder to read, but it looks correct to me. Linus