Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5121835rwb; Tue, 6 Sep 2022 19:33:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR5SfttliBkK3040ccpABSkmZLuBVA4gb2iAi50Dj5gn/p++NILrK5a1yus2TESfdaoNjWCL X-Received: by 2002:a17:90b:3144:b0:1f5:829e:cd49 with SMTP id ip4-20020a17090b314400b001f5829ecd49mr28573420pjb.80.1662518027464; Tue, 06 Sep 2022 19:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662518027; cv=none; d=google.com; s=arc-20160816; b=FFQ/50nf4dAiw1rVl9aJbjEd++igJWv1GSgqc/Izzvyxl8XG5Tx1ISC9KuTZYv9TwT Dgq/EHM1ure0UZJVAxx9jcZqSk0LcbZSqLT6hxbVwWXUzPqtvvQenPXArb9dnPfAD/v0 t2KduxUosucEi0708OZO219KH2/7/QtvN7NrtE+MW2glCC8VVTnJiKJI37TGe3MbBNfB ReH+WqAnSnywetmG4sK+kyiumo51nMGBuIUb2ZBYVj84jASNJbN5YjydKuKUpWjfYW69 bnzXUJdrd6DUDvVJdcByhrrEEEthV+oQ2VAwGUtNQEoi1bwBkfTv22J1u8DuLBgMf5z0 tJ3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=EFy/QSO0F4j4Apu6RDsR6WCOc7oRq8bSTcHPqIPG7Ts=; b=d+fpG3qPLMBSush3hpsMovGPC+QThsuzbyl7dgfnUaLe/Bxgh3WVCqN6X4u40u0D8y S2CCrOEI96F1Ar/sNb7EjrT+r2lBmMIdhiAMK2Rv8/WR68mSvARFkL6PspsEli3TO8+J /0l27rRN0jDGsdo66x0PNuZ+zytjRO1v60yq1xGSvnnGkVVVClgUDpCpuezr9+z6Q+if wU1SOxRQP46nMhDUgBdrwl2EU4No1Z1M+YRbHZUA6HBZp3F86JAzZ1Y4ekvtDfpVkYRc b8KIMnJMtErcVSHaXoB6STJvs8M18jlIzH4TXNQvNYlS9uufq2yLbN5AAaPAxhiy0OPa ThZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=CCb3YOlF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu16-20020a17090b389000b001fe26541581si23278693pjb.91.2022.09.06.19.33.35; Tue, 06 Sep 2022 19:33:47 -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=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=CCb3YOlF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbiIGB7c (ORCPT + 99 others); Tue, 6 Sep 2022 21:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiIGB72 (ORCPT ); Tue, 6 Sep 2022 21:59:28 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66EBC260E for ; Tue, 6 Sep 2022 18:59:26 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id bq23so20175231lfb.7 for ; Tue, 06 Sep 2022 18:59:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=EFy/QSO0F4j4Apu6RDsR6WCOc7oRq8bSTcHPqIPG7Ts=; b=CCb3YOlFRGWWKGrdlvaf62RkHUFHvgRy9Pl9Rd5dpb7MJ1mMzrDvjPIFfvyJGxq521 HLL2gwDh9W9SZJY07tUIEXxkzko4IKHaUexEgGUbock7JFGJgk+c4+zs+ethDsttKJnY Cre2ZzqRNPSSsrPTR4DL8YcPz26qn7efBPg/zkVnaxZmdOhYBiVhTRpxr4GnqiCY3YGJ OMPGf2KDNvlMBdDnInQqa2lLDl+mU0OYpsPdblH6WJafSsaPhsF3OwuIuAVR9jzK6Hlo 6lJ2qANjOJosL8cVbuKIBu87cnBuGSV/KdwBRcffz4+QXJVmy/yCLoPNO8vP3GbByP6H CxEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=EFy/QSO0F4j4Apu6RDsR6WCOc7oRq8bSTcHPqIPG7Ts=; b=4cFsDrFdQmAECeyWaDauoNCem1XrmNz8bgJGUSc13sFy9iw2CRqr0688imYjndwuwF rAoooHC4GWJRgHzYrBH1I/39WMe+nH1guSHMBE8Je/mZq+R8SqD4CR9lKo7GZXjqiJLT D0z69JORHEMx4XU9x8R60m3XbUQJoCFGo5xXazb66apLUIqGxdwu+/kz236Gl/OGWNbt OWOQgvMJ0HGEDK9n++0JyLCnBRzmAIsgDISkcibi/9LUddeDoBULm/83dDH1vNGlXixd KaYAD8Hnlc//uS2/16Mf6fAITMS/459Udcox3o3agPIBlY4bfi4Knj76Hc8XdORVdSSj qVbw== X-Gm-Message-State: ACgBeo3nzYu69gfba3JHFMXCUIEXtShKEW1AGcqYJljcjgJSrF3NEumo QJZwljL/P0CbqL53KVdweczOKOjzWhuCmPCERCTa1A== X-Received: by 2002:a05:6512:3f05:b0:497:9e06:255b with SMTP id y5-20020a0565123f0500b004979e06255bmr355206lfa.175.1662515964784; Tue, 06 Sep 2022 18:59:24 -0700 (PDT) MIME-Version: 1.0 References: <20220906101555.106033-1-mie@igel.co.jp> In-Reply-To: From: Shunsuke Mie Date: Wed, 7 Sep 2022 10:59:13 +0900 Message-ID: Subject: Re: [RFC PATCH v2 1/2] misc: pci_endpoint_test: Aggregate params checking for xfer To: Greg Kroah-Hartman Cc: Kishon Vijay Abraham I , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Arnd Bergmann , Dan Carpenter , Bjorn Helgaas , linux-pci@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 2022=E5=B9=B49=E6=9C=886=E6=97=A5(=E7=81=AB) 19:58 Greg Kroah-Hartman : > > On Tue, Sep 06, 2022 at 07:15:54PM +0900, Shunsuke Mie wrote: > > Each transfer test functions have same parameter checking code. This pa= tch > > 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_endpoi= nt_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_e= ndpoint_test *test, > > return false; > > } > > > > +static int pci_endpoint_test_validate_xfer_params(struct device *dev, > > + struct pci_endpoint_test_xfer_param *param, size_t alignm= ent) > > +{ > > + if (param->size > SIZE_MAX - alignment) { > > + dev_err(dev, "Maximum transfer data size exceeded\n"); > > + return -EINVAL; > > + } > > + > > + return 0; > > +} > > + > > static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, > > unsigned long arg) > > { > > @@ -363,9 +374,13 @@ static bool pci_endpoint_test_copy(struct pci_endp= oint_test *test, > > return false; > > } > > > > + err =3D pci_endpoint_test_validate_xfer_params(dev, ¶m, align= ment); > > + if (err) { > > + dev_err(dev, "Invalid parameter\n"); > > Also, you just printed 2 errors for the same error. Not needed. I see. I'll also change to using the dev_dbg() in the next version. Thanks, Shunsuke