Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1881969pxk; Sat, 26 Sep 2020 08:16:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKxd9NhQ9HVZloVXvZxpeg1upvp+oVUzT7aA4MHndDC0CnA+j4vLO69TTFqm4vI1AVa+jF X-Received: by 2002:a50:e78f:: with SMTP id b15mr7165077edn.104.1601133388530; Sat, 26 Sep 2020 08:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601133388; cv=none; d=google.com; s=arc-20160816; b=MF/XvFxZ+2zQXqNB1jF6ChZgJ+f+yxrm9Bf1iA85wovxJORnhAShysyXM5Ibg/J4B7 J0ABPnQhLgKhDpeieMwgGv2ePWxqhGF3IoEiRyIzPVY7Gn1jm31tm4zUmX/yOUJVgs67 0KicBsxN9r9aTZ3vQdcf5ZHOED4HKTsqiMwuBcIURwvCnAvQMGIw40VdtrRnbAv9kuMN kvbOJZxxOK/9r++5ORSBGOACre55ofz0t2gXRTMsQgNhgdwFgl7sbTrvBdl/NxRPBQkf W3HxZnP3vXypzG14ghCyiFbq0731J8w6kEy8bLJX84GxoDCrueISMKpBezjesm2U+xOo MIZQ== 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; bh=XFCNzQoUJxvkOayFaSmgDyTbbNdVplA2WMGdrYkcvgA=; b=cGj6XwoK6j69FYKSSZwNo72Fn+ieJRixznUe7hji81RSeq5IOtuR4q3FJKZkNng59O Qh1+Du5/Cunj7VYvNl7YCpd3i5iYvyiuXiB6T9tGfb9LZEBtA+lN2b9BM+wgQjhFxE27 eNdMkUAiIhEKVdtJqdVQn0LT8k73ixpfq5mjrcgAa0qDq7ZTuvXDkm+A5/kLGWTGdUCD thCgeoVnpdptTweNQy5goj3ynzdYJYX3zz62DOILRea670OGyh+OqI3getU3YEvVUPB4 QUBjxc8QIL8BW1qG104bNpy7mw6zC4ORD5Gi8H2D9uFYfVLzkmPO3XMoh5fJHWtofonY k7Ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si4884968edr.356.2020.09.26.08.16.02; Sat, 26 Sep 2020 08:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729418AbgIZPPG (ORCPT + 99 others); Sat, 26 Sep 2020 11:15:06 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:60301 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgIZPPG (ORCPT ); Sat, 26 Sep 2020 11:15:06 -0400 Received: from mail-qk1-f182.google.com ([209.85.222.182]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MsqIi-1kbeKl3Scy-00tFjC; Sat, 26 Sep 2020 17:15:04 +0200 Received: by mail-qk1-f182.google.com with SMTP id w12so6069660qki.6; Sat, 26 Sep 2020 08:15:03 -0700 (PDT) X-Gm-Message-State: AOAM530eqXv9zB1vGgLFwHUcD8vx+oIR7H5zJwOx8jxIGiGutbBrZKM6 Cet6nbvgY16w/JYIjcRHk/0+jX4I5GlSUUu8i0Y= X-Received: by 2002:ae9:c30d:: with SMTP id n13mr5026781qkg.138.1601133302598; Sat, 26 Sep 2020 08:15:02 -0700 (PDT) MIME-Version: 1.0 References: <20200918132439.1475479-1-arnd@arndb.de> <20200918132439.1475479-5-arnd@arndb.de> <20200919054148.GL30063@infradead.org> In-Reply-To: <20200919054148.GL30063@infradead.org> From: Arnd Bergmann Date: Sat, 26 Sep 2020 17:14:46 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/4] mm: remove compat numa syscalls To: Christoph Hellwig Cc: Alexander Viro , Eric Biederman , Andrew Morton , "linux-kernel@vger.kernel.org" , Linux ARM , linux-arch , Linux-MM , kexec@lists.infradead.org Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:Wlmaw6PiSTzXpXvV6f+4eARGE7yf05ZGz6+SR1x5QM7est/yLiL amRB6pOLleH+hHd8GQONGcBDf5YVJcTMDoFcUzxXY0NLrzpG5dnO482o0bdU7NK72YzeY38 b6K435/4UgKAkRkI8QCXmiw6NPFUONMxxDZUoqk/kCoOkzLA9CZCQo13fGl1j4wrmP3Geg8 xuJrzKMpYVgwkARri/3jg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ql+KTAtFLqY=:LospJZPxo0oCkNMAQa8kOx IvvKYCgIZOVcun3QQdOQEi4nyuz4pv7d4kNVf0xlQwc6lVa3uJYDD9bmAtzn3vKprHTj+gFuz tIkREpAMsaKmINnlgF2gaSYHTeGiBbyEk4/zntVgSBGkkf54QK2Q9u8+UMcxQcFJxuedEyM07 SHuRXou9duxVH/OBZPR9FtdfOy6YQr2xIcxtYDNFKbzyDWs0F8m+9dtWClc7xFMu/LBa+nJpu rXVIvRR74YRRCruB+QOu1uyp/CtBBTjYRwRSUPKloifAkd7UWkZNVeLCyqogA31FkM8bpUmge c/VL3vWH2liR0/wvnuPDOTaauuBo4+yrRUng3Qt8/swu003Epm3SwbDDS5sNpiK2bX7ZdZGqD dUcTJXAxhVcBsmdm2JbOS2yaRxGFTXk/Dlx6TS1WUd3t/q9A3zOc4o73cEfsLVFqsWFA+Hz4Z 48jzoX3G/U6QfaXCR7gDqG/qPFKCTLmbvGTJsBfUHeVSSO6KZPchf59l/c/+9QQlVI12cjdja 6NS5cL1qKD4yIspGoMGfxXQA9qYpGCGvCnPK4Jg3Pmf4C9gbgknRszyvqifYDKAQp4c7SZgyG lCPBUGvEcoCENK53wqJ6EudwPBqY0pLiS9UlPc52BRMNMwXjNOi9S1E5vIMH7bkeu7eAzP+aD JMIW+h83gJai7QAkRX2wk5nTsvIrSHEH7ZU/gVdtwa1LIOBBeIXC39fb5mYIpplUAGlWUikLw ymVMSiFkFMGCqMWrrhPtCIGaQJep/AMCuFo1TYed6jYfXXMBvaZI2xEcwYDkheL8vutqFBCnH 9dDwN/8q83yRJgXhhvtp1eFsQKhJrLi9P7QfY24rGbbTG3YfPwC2EQM8iAXbN8BY/QMGxz+ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 19, 2020 at 7:41 AM Christoph Hellwig wrote: > On Fri, Sep 18, 2020 at 03:24:39PM +0200, Arnd Bergmann wrote: > > +static int get_bitmap(unsigned long *mask, const unsigned long __user *nmask, > > + unsigned long maxnode) > > +{ > > + unsigned long nlongs = BITS_TO_LONGS(maxnode); > > + int ret; > > + > > + if (in_compat_syscall()) > > + ret = compat_get_bitmap(mask, (void __user *)nmask, maxnode); > > I'd either pass void __user all the way, or do an explicit case from > the native to the compat version in the compat handler. Changed to if (in_compat_syscall()) ret = compat_get_bitmap(mask, (const compat_ulong_t __user *)nmask, maxnode); > > + else > > + ret = copy_from_user(mask, nmask, nlongs*sizeof(unsigned long)); > > That whole BITS_TO_LONGS(b) * sizeof(unsigned long) pattern is > duplicated in various places including the checking of compat vs native > and probably want a helper that includes the in_compat_syscall() check. I don't see what you mean here. I can see how having the helper would simplify copy_nodes_to_user(), but not how it can be shared with the use in get_bitmap()/get_nodes(). Arnd