Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp432074ybz; Tue, 21 Apr 2020 11:51:29 -0700 (PDT) X-Google-Smtp-Source: APiQypKuOmx7nPRpOBZrzdHImEubBNfMJcZD6Bn/kHMKXuzSmibucTghqLcvOdbjnSxe+pO8e/Yt X-Received: by 2002:a50:bf4d:: with SMTP id g13mr19562745edk.381.1587495089243; Tue, 21 Apr 2020 11:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587495089; cv=none; d=google.com; s=arc-20160816; b=HGO4HDYusXYgVVG3XcB++ISJ/gin/U07su4nwPaHw/v4s1JlzexMtt1xh1wXBIHlo8 zu4A9AJSCSN0M1GlMsNDHlqXzYFDuXeGeplTi6lJDc3lpdUiH7MVIjgDz644CTgA4rSw a+c7xz2pvII8miW4dCODIOfLnrnCCj2NExHQ03bpxGyaYAXj1PhwnM3s1Az4hjxuztwj S4ZmtTfkfafg3FtIv3sW9IoY1oJgKCN/7zYpZVmbwHtHGSvwnF+rNEIGFZSdFJnQf4ou ovmy1tKTn2P2Iq6pL4cEZ+fZvGrLwypUIWcg/vrwN8XNfnZCJy1oRLHnBytA7ixxwXHI sA8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=T9rWc49Q3hArpsLqhu/pCL9axYXaiQS0ONb6lqOQZGk=; b=VQyMwyHq4rVuQUooI8vu/6nUvhZO4oRwe+L4hd72vp6k2GuW31fSg7Q0/yQ5XRlrBT 7h2bB+Jsg3XVV+F2A4cSAyWbjXGnQyP+j6LI2wa/6+bkxhLUDeUYAiGEqo+mg9zCOC8g 3FGiiKXqk9SSGHEW0hiR2WOuK0oHi9MpOZLzuNZXrx2EVxWjKPqZpBQoQb8/YBlQ/gnE GfgbQs8fAeEqGg/1ZCacr+bj4/W5kqpXR5uFe8O4gJXX75v1jgNBKBv5SB28sABbUQQq sNzLUOXPIyvwi1cvV6/mLmvbnVjaL8BBH4s/hpTyl56PuIgZyqzrouYskbrA49Y+4/zD zgoQ== 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 h4si2175118ejo.186.2020.04.21.11.51.05; Tue, 21 Apr 2020 11:51:29 -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 S1726384AbgDUSuG (ORCPT + 99 others); Tue, 21 Apr 2020 14:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726164AbgDUSuF (ORCPT ); Tue, 21 Apr 2020 14:50:05 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA758C0610D5 for ; Tue, 21 Apr 2020 11:50:05 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQxxl-007lIL-Bu; Tue, 21 Apr 2020 18:49:41 +0000 Date: Tue, 21 Apr 2020 19:49:41 +0100 From: Al Viro To: Christoph Hellwig Cc: Andrew Morton , Jeremy Kerr , Arnd Bergmann , "Eric W . Biederman" , linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] powerpc/spufs: simplify spufs core dumping Message-ID: <20200421184941.GD23230@ZenIV.linux.org.uk> References: <20200421154204.252921-1-hch@lst.de> <20200421154204.252921-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421154204.252921-2-hch@lst.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 21, 2020 at 05:41:58PM +0200, Christoph Hellwig wrote: > static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf, > size_t len, loff_t *pos) > { > struct spu_context *ctx = file->private_data; > + struct spu_proxydma_info info; > int ret; > > + if (len < sizeof(info)) > + return -EINVAL; > + if (!access_ok(buf, len)) > + return -EFAULT; > + > ret = spu_acquire_saved(ctx); > if (ret) > return ret; > spin_lock(&ctx->csa.register_lock); > - ret = __spufs_proxydma_info_read(ctx, buf, len, pos); > + __spufs_proxydma_info_read(ctx, &info); > + ret = simple_read_from_buffer(buf, len, pos, &info, sizeof(info)); IDGI... What's that access_ok() for? If you are using simple_read_from_buffer(), the damn thing goes through copy_to_user(). Why bother with separate access_ok() here?