dmaengine Archive on lore.kernel.org
 help / color / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Vinod Koul <vkoul@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	dmaengine@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: off by one in cleanup code
Date: Wed, 16 Dec 2020 09:22:15 -0700
Message-ID: <20201216092215.000061b6@intel.com> (raw)
In-Reply-To: <X9nFeojulsNqUSnG@mwanda>

On Wed, 16 Dec 2020 11:29:46 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The clean up is off by one so this will start at "i" and it should
> start with "i - 1" and then it doesn't unregister the zeroeth
> elements in the array.
> 
> Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of
> driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Dave Jiang <dave.jiang@intel.com>

Thanks Dan!

> ---
>  drivers/dma/idxd/sysfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
> index 266423a2cabc..4dbb03c545e4 100644
> --- a/drivers/dma/idxd/sysfs.c
> +++ b/drivers/dma/idxd/sysfs.c
> @@ -434,7 +434,7 @@ int idxd_register_driver(void)
>  	return 0;
>  
>  drv_fail:
> -	for (; i > 0; i--)
> +	while (--i >= 0)
>  		driver_unregister(&idxd_drvs[i]->drv);
>  	return rc;
>  }
> @@ -1840,7 +1840,7 @@ int idxd_register_bus_type(void)
>  	return 0;
>  
>  bus_err:
> -	for (; i > 0; i--)
> +	while (--i >= 0)
>  		bus_unregister(idxd_bus_types[i]);
>  	return rc;
>  }


  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16  8:29 Dan Carpenter
2020-12-16 16:22 ` Dave Jiang [this message]
2020-12-21 13:59 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201216092215.000061b6@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git