Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3096924pxb; Thu, 10 Feb 2022 12:09:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwebiKPo94CbdOEbXQGiUPIJRhAyy94UjEVYe/9viryHpCnT12r8xtBf4ibBUV49QOOzRWd X-Received: by 2002:a63:a1e:: with SMTP id 30mr6852pgk.502.1644523767615; Thu, 10 Feb 2022 12:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644523767; cv=none; d=google.com; s=arc-20160816; b=IbuE773aQZ9uV3OSFWW0BxXhwYXRIGzL3p/cSbZdOw/Y6OGrbA1GKIOmZuHZ5qH2Jw P1BwPm251ipoNvAtwoXO919gaEC2Ag34FrJLt0txEDNxGSP50Rsfk3aLqRBOjbNPoLbN QP+z7W3W2gY5aRmrM+0SrJ4U16TpaAToHQtEfOoGxWec+sUeE2Q5eD+cAQPEfCi5lFUL FgLLDYo1t3iNR0iT9OB9c79/bsgrmT0V2nEflLdxLNLEmQwdzrbTHP+NtJjbb5dGuTrg IplFnkA6fQB1iOWGxEy4YprHuwxkddlH89SKHNxHkVV3JckBaqCBXzzwZeYScEr0WBXS ck4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kporJ279g00UXwRiWO51ZM3srvc07QYkw6mDyEn+19g=; b=X9oQjZrCswbx+q/5SjeOkQlpbAVD81qZGtsKALRq8fFdOiVV5ZibKJ7DJOFgb3siQF KMHibeT0i1bFEUI57z/rxuOlb3TSJBDrraZjPfC5k09IUGm5u8CjuW6HCE6+jTEz/yYI nNd0JCf1id8iFXVgaqJfDcf93pZTqDM+yQvVHtMzRtmifpUbnTNt9fQcF8/pgWZzr76z dcqHduYGC51H5uuci1h/rRtug5kvucwkYdX80ibekvZUJQpFWdrIG0VkKbyTpZdlwnp6 dcdIOQyh+qZOuIHZ9tzdXJJxX+k/4melFz5V97Hzta4ezNrQo7VO/6ZRABsYDO7CNCsF MzWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a4YfbtS1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11si1697514plg.205.2022.02.10.12.09.13; Thu, 10 Feb 2022 12:09:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a4YfbtS1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243246AbiBJOyN (ORCPT + 99 others); Thu, 10 Feb 2022 09:54:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242942AbiBJOyL (ORCPT ); Thu, 10 Feb 2022 09:54:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C09DD96 for ; Thu, 10 Feb 2022 06:54:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B622B8255A for ; Thu, 10 Feb 2022 14:54:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B9F2C36AE5 for ; Thu, 10 Feb 2022 14:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644504850; bh=Wrhb3S8klJMz7NSMKYsAwfxDSgIdAnsOXa1GaJGwWaY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=a4YfbtS1KvUvU6nfp0IwQ8+mC6ESwTt90uNo6ti2F4AKAnQ/jwjcuOprh00Ok0U87 /UiO9cET38+oBC25XZq8xjPVI3Wk5aQZkXr9MNGsCFwfR79gFf3Pq4iUCs5sNAnUIH FE46ACvAC5C7Q3WG1zXYs0PXb5gtPiUxeok2e5nOxqUxyCuTNyckIpPEXgj6sni+Mn BTercxk7Imz/tgfmmWlAul6rCFCO9FdOKAmb8l+X9CI8gz3IM3EvOG8+BPF4ieBKsF hPGVp/xH+yP3Li66fwOuiGAKKQ52cRc4xCJJnuI1RBswop35CdT06uzI+TtR0FlXjk bzf7bwTeMPjqA== Received: by mail-wr1-f41.google.com with SMTP id d27so6267800wrb.5 for ; Thu, 10 Feb 2022 06:54:10 -0800 (PST) X-Gm-Message-State: AOAM533VilRaElI7QAZwQzdDt/NGD0sNzkL7SPXBYEurm4/YIDlpGoWa bKQqysjW40tJOUpzZiGTqJKrZJqmGkOx5aeX46E= X-Received: by 2002:a05:6000:3c6:: with SMTP id b6mr6520953wrg.12.1644504848550; Thu, 10 Feb 2022 06:54:08 -0800 (PST) MIME-Version: 1.0 References: <20220209144910.1484686-1-arnd@kernel.org> <80c6df0717014472aa81093ae3894d39@AcuMS.aculab.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 10 Feb 2022 15:53:52 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] microblaze: remove CONFIG_SET_FS To: David Laight Cc: Michal Simek , Christoph Hellwig , Arnd Bergmann , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 10, 2022 at 3:21 PM David Laight wrote: > From: Arnd Bergmann Sent: 10 February 2022 13:30 > > > static inline int __range_ok(unsigned long addr, unsigned long size) > > { > > return size <= TASK_SIZE && addr <= (TASK_SIZE - size); > > } > > > > since 'size' is usually constant, so this turns into a single comparison > > against a compile-time constant. > > Hmmm... maybe there should be a comment that it is the same as > the more obvious: > (addr <= TASK_SIZE && addr <= TASK_SIZE - size) > but is better for constant size. > (Provided TASK_SIZE is a constant.) > > I'm sure Linus was 'unhappy' about checking against 2^63 for > 32bit processes on a 64bit kernel. > > Hmmm compat code that has 32bit addr/size needn't even call > access_ok() - it can never access kernel memory at all. I suppose the generic function should compare against TASK_SIZE_MAX or user_addr_max() then, to make it a constant while TASK_SIZE potentially depends on compat mode. Arnd