Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp104140imu; Tue, 8 Jan 2019 15:32:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN4o5e5iqkISsne82Ys34Wc9EEgN6R1I/GFKlYTewuaslEmyfvTqCcHmUiLLfzs/O3RWPK6i X-Received: by 2002:a63:fb15:: with SMTP id o21mr3300328pgh.211.1546990349479; Tue, 08 Jan 2019 15:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546990349; cv=none; d=google.com; s=arc-20160816; b=L25XGPCgxX7ifNALD6PDKBhxAXNseQggj4twJKNEdzLRrmEn7JE3V3PGBGr9hMczxF zgpZAmzzRRORm6SZ3zIMpC9KkfJhvor5KJjxgfkECLkulITwIPX25eaUWGfFt2NtmR3B sqAz8ehULmKWleCgfAthNEHdyLIQdSgJmQMHBbtgBKvJWBt3FtdvjwKcDKyrGtNUQb0Z H6yhGurGKTHFgLJgunczKhBYiRGEAorYOzdWkD5+HNCwzZ12WplfIoAOslDKvQC28raL acpoGvEtF4IzAb5iHCGdsuzsODtfQlyClZ73upb/LhXWQdslhic4Jc7eXK89n1Bm6h/5 MJRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=G+t/O1ELjBLEBBBsDmJXREgcMLTIWAYtBGNLhxBHo08=; b=rQxnYDLX6KCSZbB+h254JFYkXku4293x28vYZOt5XoykgrwRKQMiPsoUjzzugsek8a x6ZaV8RXeLFvUSmoXgTYUKZk1v3OJUMYBrUUwlQvLFa/7dPQ0x3cxEYYETOvvJk+zqUE C/WxG+ZRACOyuu48f6/zOGjUm8siGH8R/qGIKcEnavQnHmnEu8uJlRIcVwW643v2AlJR CfOc5/CVxyfczAeOB79bC+UjsZ4o5wd1vOmxrsJNA36S8BJ488wzaDnMzcDd5bNdKc9X 8Dt1wyem6cd7O7ZsEdyutYKmnfViFSGN4S5X0i1r6yAnB8m6JCYlCcwTOQbmr9E0LfeE YNuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t6vCh9lE; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i90si4440559pli.135.2019.01.08.15.32.13; Tue, 08 Jan 2019 15:32:29 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=t6vCh9lE; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729822AbfAHWhw (ORCPT + 99 others); Tue, 8 Jan 2019 17:37:52 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43191 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728617AbfAHWhv (ORCPT ); Tue, 8 Jan 2019 17:37:51 -0500 Received: by mail-pf1-f196.google.com with SMTP id w73so2604719pfk.10 for ; Tue, 08 Jan 2019 14:37:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=G+t/O1ELjBLEBBBsDmJXREgcMLTIWAYtBGNLhxBHo08=; b=t6vCh9lEnH2SNgS8RuQ8h56OJCXt5sxw1vDNhObrCk7bZ6ugFb6FGLoSeLEThy1F+v NXaRPTTDqw8mz7Q63gLjusueIN7uwXQdedqn8i6la/+CJqwg4lxoU/n2f5rgxPvWCNIg 5ZNK9dRjJoYIVHZ1+jO8jb4IYuedj/nEXmskeH+v6XjMbo3gydDcEeRlZTnLNkIMrLnQ +OzjhUTa5oGoo1/HxtzupxnftQuUWEEItZCDs9j1cxf/mNoOpl3vIxlDf+fnkbXu5sPp jCZuh/ZRfvgtwtmVp5maapI1pLaMCAcNcnhoW2qc63sjkiM/eAwfo/DRnn0pgswp9Q94 dhGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=G+t/O1ELjBLEBBBsDmJXREgcMLTIWAYtBGNLhxBHo08=; b=E5KOdu4LIqh+VVXe6ZdfDNR5QapOQmZwCne3lkcMhlbWnhqGBat0YVn7weeeV3xRq2 qHpMYjK5jlXTvCL2AEBQMXkX/a10epKJnRLAta1ZMMA0ghjrYDCFXzKJUWDyn8YsKZGE pLdVFLoKXfChSYC31YFBe7va+F0OHDSp2xjiafccQWE+z+oEMz6VB6ktymWGrbo4cubi cs0kOzu4/RwKPSKPuG3XB/gyMh1upKpkjioluA+0It0rKOtfpH43oAtXxVFuEWWuzlzw jgh3nrlCu1DVlM4zH/s3JQOB89W0kfuF7SrqaF7pgFH9aUdldIqr8zkAcjC2158c60ce DrXg== X-Gm-Message-State: AJcUukdDLA1DGjlDOXXmba7Kh5IhRsXBy/DixZrQfajvtkXbqgro0Und S0SGxyOCVjh7PMuu2kh1FeE= X-Received: by 2002:a63:a112:: with SMTP id b18mr3193252pgf.440.1546987070352; Tue, 08 Jan 2019 14:37:50 -0800 (PST) Received: from localhost (g206.124-44-15.ppp.wakwak.ne.jp. [124.44.15.206]) by smtp.gmail.com with ESMTPSA id d25sm113129172pfe.40.2019.01.08.14.37.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Jan 2019 14:37:49 -0800 (PST) Date: Wed, 9 Jan 2019 07:37:48 +0900 From: Stafford Horne To: Linus Torvalds Cc: LKML , Guenter Roeck , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: Re: [PATCH] arch/openrisc: Fix issues with access_ok() Message-ID: <20190108223748.GR3235@lianli.shorne-pla.net> References: <20190108131516.27903-1-shorne@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 08, 2019 at 10:16:39AM -0800, Linus Torvalds wrote: > On Tue, Jan 8, 2019 at 10:10 AM Linus Torvalds > wrote: > > > > On Tue, Jan 8, 2019 at 5:15 AM Stafford Horne wrote: > > > > > > The commit 594cc251fdd0 ("make 'user_access_begin()' do 'access_ok()'") > > > exposed incorrect implementations of access_ok() macro in several > > > architectures. This change fixes 2 issues found in OpenRISC. > > > > Looks good to me. Should I apply this directly, or expect a pull > > request with it later? > > Oh, and replying to myself with a quick note: it might also be a good > idea to just make it an inline function. > > The only reason I did alpha and SH as those macros with a statement > expression was that because I don't have a cross-build environment, > continuing to do it as a macro was the safest thing from a build > standpoint. > > One big difference between a macro and an inline function is that the > inline function requires everything to be declared at the point of the > function definition, while the macro can use things that get declared > only later (like "get_fs()"). So a macro can use functions and other > macros that aren't declared yet, but will be declared by the time the > macro is actually _used_. > > So when changing the macro "blind", it was simply safer to just keep > it a macro and just make it a bit more complex. But since you can > build-test your changes, making (for example) __range_ok() be an > inline function might have been the cleaner solution to the "use > twice" issue. > > But your existing patch looks fine to me too, so don't worry too much > about it. I just wanted to point out that the reason I did alpha and > SH the way I did was not some "macros are better", but rather "Linus > is weak and lazy". Hi Linus, Please take this patch directly. The inline's are a good point. I will take some time to address this and some other cleanups. Note (for others) I had to apply patches from Masahiro Yamada to test this as v5.0-rc1 build was broken for OpenRISC. Those patches are already on Linus' master. -Stafford