Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4862718rwb; Sat, 10 Dec 2022 17:17:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf5LuwWEBLP6F8rksUHWeMGJ/ogfEehZenzmjTB7/Ew8agdnAi77Aqtyb4UoEvTlN58i8Jtd X-Received: by 2002:a17:906:164d:b0:7ad:e255:9238 with SMTP id n13-20020a170906164d00b007ade2559238mr9175464ejd.21.1670721434061; Sat, 10 Dec 2022 17:17:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670721434; cv=none; d=google.com; s=arc-20160816; b=uUpGgXv1zvIhT6ASBbR9jJ0shYJOyoVTqKzQ79GUkXdJsxcEaP+bFu9+cQE/tbVQj4 pMbRK+S9JQpz3ylSVAQ2imE+Mm2WP32axsH/tAXBEgoI5OVIU9atIeqJwWb7gJCjfVJI BchhYy10/TY8qjVcsH0Swv8JapmFwp3+xzk4tBdRhD6T5GH7vJoZHp1a/gwdR585OBhK PSxW1AVqfJEVPTX+F6VswqD5JS9E1RUGhTdphQ9fPyFH+IFua6aKd4/EuhKnNZFx4b6U LOgvTn4//8nqAquAkjXnp3GjY+yVpUIheDSZrC194yucPkUHRNYmIL7R0HinMgcdo9q7 iCyw== 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 :dkim-signature; bh=ko2Bdie58wq+qfL0iVpDiNVXLRQwo/jVbmX5noXhSs0=; b=VBQtvIzs+EUhrToy8Kob6eSPGdPhjj1yhoWPkqVuzd+sJTuLJEgNt6h3bcEVdTbwJx SCI/J3wRK3zojTKJw4kNPSY0AaPtmFgn9l41eyaeIsmLGlsyeGXbYTPN+IaI360x1Y+0 oKeixZG9RL4PuPSjYbgZmA9x8fY0lSE//m2wmv9jvo3+Zk6Y8ZGdG6X3Dv5mqjDsCj7z ZL45wU+NVszM7aiJTm13ERMeShgVa25DsALPmEIDjPB2++8ucenl19ueNAk2xOm+R6oW CJXaYEJzAK3sjj0XLQHbpDJfnWB8rL2Ofd/O3jjslUd5a3LLhfYX8+Dm3XXd8EuUP43F jD1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b="AElgV/H0"; 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=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a170906194800b007ad8bd5b636si2577456eje.377.2022.12.10.17.16.56; Sat, 10 Dec 2022 17:17:14 -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=@linux.org.uk header.s=zeniv-20220401 header.b="AElgV/H0"; 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=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229723AbiLJXvl (ORCPT + 75 others); Sat, 10 Dec 2022 18:51:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiLJXvi (ORCPT ); Sat, 10 Dec 2022 18:51:38 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F170A11C28 for ; Sat, 10 Dec 2022 15:51:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ko2Bdie58wq+qfL0iVpDiNVXLRQwo/jVbmX5noXhSs0=; b=AElgV/H0LOWNFHgrJZHIWZjYrx 7Ugtk16NVV+kKntFkQ0zS3BwRRjEGFz8WdYPlrVzhkSUbkoIhoTzOTyNU+5zYlMNLdkphZ/BPrBFO 4ZQqvzPAf8CP00IitZRYnn9uGR9Gmc3NU4zzT11+WU5kZKGRnge9xhT5vD3cZcSE6tpdd1UvyJsiP Nmo6mzzxBQqdOsY3VQTrLFOLfulbq5N5NfabZ3MnojOMFi4Qf0tkJRT34uMYdgYi5sQrOONhMsX2z 8Fa17RQNez5SNU22Ht4FD1n0NDngpko2trWQh/aNgFcuP5DTjepFFPaXxP7RtDo1wmVYykCOB3Cef tmhIoX+w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1p49cy-00Auet-2n; Sat, 10 Dec 2022 23:51:32 +0000 Date: Sat, 10 Dec 2022 23:51:32 +0000 From: Al Viro To: Nhat Pham Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bfoster@redhat.com, willy@infradead.org, kernel-team@meta.com Subject: Re: [PATCH v2 3/4] cachestat: implement cachestat syscall Message-ID: References: <20221205175140.1543229-1-nphamcs@gmail.com> <20221205175140.1543229-4-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221205175140.1543229-4-nphamcs@gmail.com> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 Mon, Dec 05, 2022 at 09:51:39AM -0800, Nhat Pham wrote: > + if (!access_ok(cstat, sizeof(struct cachestat))) > + return -EFAULT; What for? You are using copy_to_user() later, right? > + f = fdget(fd); > + if (f.file) { It would be easier to read if you inverted the condition here.