Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp732860pxa; Fri, 21 Aug 2020 20:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye1usSf5GmWHFondE/8ogNZ0RuXJ6CiadrPFPULsk4eX1s2uAMRUi5rr+pg5PIBO34pZBh X-Received: by 2002:a17:906:a18e:: with SMTP id s14mr5832228ejy.168.1598068635785; Fri, 21 Aug 2020 20:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598068635; cv=none; d=google.com; s=arc-20160816; b=DcQe7JdyaU9yPmj/roAmlg0v78tK1V4S1eMJ6AUXtJmY/qfEPxOBLc4gjQ07AWFDxZ T3FCchXIQJLtF+6VloBu/aUc03uUx6bisonjmv0IZom1DbPHxuuqHaruLaMXBecDLibx SDFSH423QU22Jo3BZA91h6O8LyOjw4uOJix381etf1BKVAm+dqfMIPURjyzdZuoQvUIk Za5WpBj9lgl395bXIEuMbfonOmXzGhcdVlLKr91oiKN04+0vbbcUd0w3SPLHVEn2dppc U+QA6f86Y2pHTW1N7N1HR1AR3jD1KoOXVGXgWQJwo3Ao6aD8okHfS2DS08UXoSnkGeG+ Ix5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3e3bRZf3+QbW0+YTlgUxtLjcikMlNZDmvo/+Iue/DbE=; b=JiJJbtgYvHsqjwgKj1gcJMwfRO4nHVLnR+rnosxcm5w1/GAK759hIQv+x3heTp6hBi /mZ8er59R9CMakK110Cs/WlglgwT80bsvf/9jZhU4/Y+kNsiU734ra36oTkeDZErEfdu +OAWrS3cakZIaZk0pXoBuyXzI7akhGp+lI+EUQ08X67jUNDgGpzEoBj48rXmlcs6DDJO MU5s+ig1c5W/3xTR/tbcrJd6w8rPVWAN96HNRAsf+B1NEvr54j7612IyYnbpPZf8PTpA FBGfIurn7MTcy4MKcDXiLwMNS3zEBtQpVcj1nH5Wp72jeEUOdKYA+ioSSuDW5GhmKCBE Oc6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b7FxcmUV; 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 d27si2608616ejb.176.2020.08.21.20.56.37; Fri, 21 Aug 2020 20:57:15 -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; dkim=pass header.i=@kernel.org header.s=default header.b=b7FxcmUV; 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 S1726932AbgHVDv5 (ORCPT + 99 others); Fri, 21 Aug 2020 23:51:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726734AbgHVDv4 (ORCPT ); Fri, 21 Aug 2020 23:51:56 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B6E720720; Sat, 22 Aug 2020 03:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598068315; bh=3hIC6oRMGaUVHp80xG0vx5OQ9SD78ONNbz0W0ALeSwg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=b7FxcmUVmfN2xqBPz340ulOe/XVSHR1MiU9xpeeaPdZHxS9vz4pUHKgNOmHzMsWdI 329/g50Jv8wzcvUyrJ6y7b7lCfOXhfTqhhQ+F8qGxN56DpcoWHovn+DqN4azIYpKWe R849KB9bd5vjxDb+inkYQypN25eBC2PbnWxzixOw= Date: Fri, 21 Aug 2020 20:51:54 -0700 From: Andrew Morton To: Pascal Bouchareine Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , "Jakub Kicinski" , "Alexey Dobriyan" , "Al Viro" Subject: Re: [PATCH v2 1/2] mm: add GFP mask param to strndup_user Message-Id: <20200821205154.365e230dbf6f2b93a47443c4@linux-foundation.org> In-Reply-To: <20200822032827.6386-1-kalou@tfz.net> References: <20200815182344.7469-1-kalou@tfz.net> <20200822032827.6386-1-kalou@tfz.net> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Aug 2020 20:28:26 -0700 Pascal Bouchareine wrote: > Let caller specify allocation. > Preserve existing calls with GFP_USER. > > 21 files changed, 65 insertions(+), 43 deletions(-) Why change all existing callsites so that one callsite can pass in a different gfp_t? > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index 1ca609f66fdf..3d94ba811f4b 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -326,7 +326,7 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) > */ > static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf) > { > - char *name = strndup_user(buf, DMA_BUF_NAME_LEN); > + char *name = strndup_user(buf, DMA_BUF_NAME_LEN, GFP_USER); > long ret = 0; Wouldn't #include char *__strndup_user(const char __user *s, long n, gfp_t gfp); static inline char *strndup_user(const char __user *s, long n) { return __strndup_user(s, n, GFP_USER); } be simpler? Also... why does strndup_user() use GFP_USER? Nobody will be mapping the resulting strings into user pagetables (will they?). This was done by Al's 6c2c97a24f096e32, which doesn't have a changelog :( In [patch 2/2], + desc = strndup_user(user_desc, SK_MAX_DESC_SIZE, GFP_KERNEL_ACCOUNT); if GFP_USER is legit then shouldn't this be GFP_USER_ACCOUNT (ie, GFP_USER|__GFP_ACCOUNT)?