Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp698310rwe; Wed, 24 Aug 2022 07:42:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4iN97uF3msxta+VXMV4CqckqarQzMQ5HWTtH5WRNk2qF32U3SNQJCHVC7mNE9/kR8gId7S X-Received: by 2002:a05:6a00:b43:b0:52f:59dc:93 with SMTP id p3-20020a056a000b4300b0052f59dc0093mr29866584pfo.26.1661352134997; Wed, 24 Aug 2022 07:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661352134; cv=none; d=google.com; s=arc-20160816; b=cei61pGc4Y8gmO+CZ6Inta6FcY6OQGqp0QHYEQqD4A5SMEGz5O0KELo+1dXl6BCgav UZ+SWEizLINpVXZ3J+4FVUCzRIq303EoJ2CoA/7QAm3rQzOvZX0IYXk8kmXwm9EQ2yyg pDUJFgyHMTPrwjdCXR7lJeWORJP+vh7/aNApj0O438++YsCcRLBAVccZ7B40jpzAWd7P wQLNHRlhGaHlFQYdBgmu/Oogc5eLBuMEKEYcSuAksCjyxaxGiJkxVq5w6HaEMsg10Xqe 4YTzdP7hhBqMddaH/RRHXdwiiHBDrO4SCxMwgjlQiy4R6Lt2lPOdLsAycrtNd8xyjaGf fUHw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SPRmeixtANGprxlqh/gVfzAE7+7y4vX0jc8n6DbL0NE=; b=muBOg9S8je2DJUt1mvra3UUPl42iBgEZno/JjqZJ5Y9yU28NG7jxVnj+QkIqwvJ8+V mq2IsmQTJe0+8Aclt7ouRVtCNoEElTIDyQkPW4g5d93agPb5DPiWoEZ7riXgQVmjUNOj vdnz7i/DY24S3FLd0+lbwIjFKhW3qDQoolkDPZCZSCNPNdQ29GYp76c4OXyx3kZrcuQ4 oUoKo/IuEEcC/7v2uFDyin/7VJb49MM98TNijhM04R0tSHRNcQpU3NWrbxgoVoo/ikc0 vCdXqZLIeJz0/4pW2vJlYXKOHRHjZOfmnFxNaig8vESAbFUcEEZ1EoMshfv+RjsU44uN qB1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y9BFz11+; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d70-20020a636849000000b0042b121594c3si2435443pgc.53.2022.08.24.07.42.03; Wed, 24 Aug 2022 07:42:14 -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=@linaro.org header.s=google header.b=y9BFz11+; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239145AbiHXOZ7 (ORCPT + 99 others); Wed, 24 Aug 2022 10:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239172AbiHXOZy (ORCPT ); Wed, 24 Aug 2022 10:25:54 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36B5B2528E for ; Wed, 24 Aug 2022 07:25:52 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id s206so15181042pgs.3 for ; Wed, 24 Aug 2022 07:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc; bh=SPRmeixtANGprxlqh/gVfzAE7+7y4vX0jc8n6DbL0NE=; b=y9BFz11+FV+njR3OB9AVA/Pr+JBW1R7I/7HpsB8R+jMKWMFxxp38tay24Y4AJW6xGC Urz97Khs6rq8/4pgjEId5GjE5XQxwtvbVf0DdeIs63JqwMV8VCig+YNtTXd2jYX+hC+j rhucvZBs4p/q5DL+SCb7aMPyTxhaRVPOEtRsnduBnOGzvfdMcNO63pMVPu8pTjc0a5Oj ea9E1IGkg7NJyNPm2NHI8mVkV1Jx2+vNmI6EkJFETYCh0Q0wzSSJffKlkGp3fOKAzRyr wy6+HMf+BLvzU1Av1NQ12fmpNWkCXVAPv02yiCGbJCVQOA1pkUGjw/++IuJLHfOF0ouJ Z0Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=SPRmeixtANGprxlqh/gVfzAE7+7y4vX0jc8n6DbL0NE=; b=1ATM8OMiSrgft7c4TPLE5u0XqYIMwwXNYNMV0PwwxuVXQ8V/OIUMugzU3ime9Ajgbb ww+d7CKPiIT9Hq/ns5x1N/jkItgZtWDg/H3eLU9Lytnrh5AZ7SFbWKeVVk0DYXWeDvoW Q9s51Tn6F75AwNrxCmBF3kPsygfNEq84oA8MSCdJRrPM6YHK4Wzth0U04b3q3+Z4dkBu RKPZan6FrRvYtPZ1cyhZZF0mfrjcq3W0NL275jb44VEBV/39lQukmiSe7gwXyvgB+i0B Ck2iheX/sSFjVOfKzc2qTy7HxVvmGkTRt56ZL6nNJXQTez58YcefHt6EcPsC69pWoXPe 7etw== X-Gm-Message-State: ACgBeo2snKdHCrHFGURJJ/u/lsUzAzNY5k1J3pXILfgIsqZJ5/tsL2yV UqilhQdBWMkdw9dGhB128QMF X-Received: by 2002:a63:e345:0:b0:429:fadb:7135 with SMTP id o5-20020a63e345000000b00429fadb7135mr23387825pgj.549.1661351151641; Wed, 24 Aug 2022 07:25:51 -0700 (PDT) Received: from thinkpad ([117.207.24.28]) by smtp.gmail.com with ESMTPSA id s184-20020a625ec1000000b0052e57ed8cdasm9248610pfb.55.2022.08.24.07.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 07:25:51 -0700 (PDT) Date: Wed, 24 Aug 2022 19:55:45 +0530 From: Manivannan Sadhasivam To: Greg KH Cc: kishon@ti.com, lpieralisi@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, mie@igel.co.jp, kw@linux.com, stable@vger.kernel.org Subject: Re: [PATCH v2 1/5] misc: pci_endpoint_test: Fix the return value of IOCTL Message-ID: <20220824142545.GB4767@thinkpad> References: <20220824123010.51763-1-manivannan.sadhasivam@linaro.org> <20220824123010.51763-2-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Wed, Aug 24, 2022 at 02:43:18PM +0200, Greg KH wrote: > On Wed, Aug 24, 2022 at 06:00:06PM +0530, Manivannan Sadhasivam wrote: > > IOCTLs are supposed to return 0 for success and negative error codes for > > failure. Currently, this driver is returning 0 for failure and 1 for > > success, that's not correct. Hence, fix it! > > > > Cc: stable@vger.kernel.org #5.10 > > Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device") > > Signed-off-by: Manivannan Sadhasivam > > Reported-by: Greg Kroah-Hartman > > > --- > > drivers/misc/pci_endpoint_test.c | 163 ++++++++++++++----------------- > > 1 file changed, 76 insertions(+), 87 deletions(-) > > > > diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c > > index 8f786a225dcf..a7d8ae9730f6 100644 > > --- a/drivers/misc/pci_endpoint_test.c > > +++ b/drivers/misc/pci_endpoint_test.c > > @@ -174,13 +174,12 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test) > > test->irq_type = IRQ_TYPE_UNDEFINED; > > } > > > > -static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test, > > +static int pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test, > > int type) > > { > > - int irq = -1; > > + int irq = -ENOSPC; > > No need to set this if you: > > > struct pci_dev *pdev = test->pdev; > > struct device *dev = &pdev->dev; > > - bool res = true; > > > > switch (type) { > > case IRQ_TYPE_LEGACY: > > @@ -202,15 +201,16 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test, > > dev_err(dev, "Invalid IRQ type selected\n"); > > This should now return -EINVAL; > ack > > > } > > > > + test->irq_type = type; > > Again, do not make a change to the kernel state if there is an error > above. That's wrong to do, and yes, the current code is incorrect, > don't keep that bug here as well when it's so easy to fix up > automatically. > Okay. Will fix it in this patch itself. Thanks, Mani > > I stopped reviewing here... > > thanks, > > greg k-h -- மணிவண்ணன் சதாசிவம்