Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4194341rwb; Tue, 6 Sep 2022 04:10:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR7IZWsGAwFv4cwjAI79usaKNaqbDRTGXPZnFZ9RdWypjHTrfL+2sZ1voZC3Dip4DiFPxXlM X-Received: by 2002:a05:6402:510a:b0:43d:ab25:7d68 with SMTP id m10-20020a056402510a00b0043dab257d68mr46525739edd.102.1662462626310; Tue, 06 Sep 2022 04:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662462626; cv=none; d=google.com; s=arc-20160816; b=CWk4bQb1bQpspLMuWTiwIuRCM/+c0rlfY0EIH3S/T5WthrFjtobMYcdu2yeQF0rkKR ELLHnBc6S7BVe6Gc63g8mDpSYfIbq7Z9R29zJdevROVY0fJOSvYOUZEmr2BkU6LLfZ12 7ziXLWFEnyf2vCLMbQBScNiBr3v+/frQVUS7W/BxmnUZoXOxD2CcDgE2jEZv9iuh+RX3 F65vcn5GdzVuvCl/66IbZ7a+geT8r6IAc4Nc5i7YjW0YGkQiebb3v91nHp6Y+bMINIgP GvpGLynaYsjjdPnVqgjarswHeBqUtPFw2MqpDWZP2767n8cDv0gv858Gat54ggH9nn6M 8W2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Mm5rES2pyKmcViuZXZD1QPCNJ24PRLLdYAH+zulYZkI=; b=BZp1pBPI6BCUM/gMeb/z3AEXyPDG5Mfj7yX/X/sXee+nCpAfOW+OUImYBDGexVON+P x2mRcn1Qbqe+tMGC+sPvYXSnswcLVOg9IMEM/7lhTSGPQzdYy3ZM3WREFHf8ifep13F/ JGsSf1S8lY2yrwFh0mJBsICUTyfjiPg+oxZgPsMqd3UentNvXW94CoS6YyXJ7Uwtvgl/ dbYxISxjIxL158TDC16EhIcxpV2e9g+RtjDh0hnlSZm4UFyGoZXeNBXDtQzxol8qzmaB txBmCi7tSVGylLhkKQi09/7OY0JERWqGJtYZpx/cYuYJEisJEF/B6V0VGNeTndyMTHA3 F+YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jmoJFCGj; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn19-20020a17090794d300b0073dd598216dsi8340960ejc.88.2022.09.06.04.10.01; Tue, 06 Sep 2022 04:10:26 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=jmoJFCGj; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239200AbiIFK6T (ORCPT + 99 others); Tue, 6 Sep 2022 06:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233220AbiIFK6R (ORCPT ); Tue, 6 Sep 2022 06:58:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C773C8F4; Tue, 6 Sep 2022 03:58:17 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id D13A4614AE; Tue, 6 Sep 2022 10:58:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAA5CC433C1; Tue, 6 Sep 2022 10:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662461896; bh=VVMTL6otukiB8F/2HYcarj4/PNAYKkz7PWViuFBZE2Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jmoJFCGjWbVxgleC4Xfd/Bb0hhJD72fEnDihbI8c+8o/djhzy5UWD4HWUTQ8bEGU1 igDNr/B6Y1ZyI9G07g/peHuZ3GF9vk9OuNckUhvIapVKI1QU54II3YpXi1Aa/qWi4z LV/lS1uI9RIRQ8WNI47rTYyhE4ETAFFjHrHN27bA= Date: Tue, 6 Sep 2022 12:58:13 +0200 From: Greg Kroah-Hartman To: Shunsuke Mie Cc: Kishon Vijay Abraham I , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Arnd Bergmann , Dan Carpenter , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 1/2] misc: pci_endpoint_test: Aggregate params checking for xfer Message-ID: References: <20220906101555.106033-1-mie@igel.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220906101555.106033-1-mie@igel.co.jp> 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 Tue, Sep 06, 2022 at 07:15:54PM +0900, Shunsuke Mie wrote: > Each transfer test functions have same parameter checking code. This patch > unites those to an introduced function. > > Signed-off-by: Shunsuke Mie > --- > Changes in v2: > * New patch > --- > --- > drivers/misc/pci_endpoint_test.c | 35 ++++++++++++++++++++++++++------ > 1 file changed, 29 insertions(+), 6 deletions(-) > > diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c > index 8f786a225dcf..3bd9f135cdac 100644 > --- a/drivers/misc/pci_endpoint_test.c > +++ b/drivers/misc/pci_endpoint_test.c > @@ -332,6 +332,17 @@ static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test, > return false; > } > > +static int pci_endpoint_test_validate_xfer_params(struct device *dev, > + struct pci_endpoint_test_xfer_param *param, size_t alignment) > +{ > + if (param->size > SIZE_MAX - alignment) { > + dev_err(dev, "Maximum transfer data size exceeded\n"); Do not allow userspace to spam the kernel log. This should be dev_dbg() at most. thanks, greg k-h