lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1506171622030.15930@localhost.lm.intel.com>
Date:	Wed, 17 Jun 2015 16:24:56 +0000 (UTC)
From:	Keith Busch <keith.busch@...el.com>
To:	Dheepthi K <dheepthi.s@...celabs.com>
cc:	Matthew Wilcox <willy@...ux.intel.com>,
	linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org,
	madhu@...celabs.com
Subject: Re: [PATCH 1/1] NVMe : Corrected memory freeing.

On Wed, 17 Jun 2015, Dheepthi K wrote:
> Memory freeing order has been corrected incase of
> allocation failure.

This isn't necessary. The nvme_dev is zero'ed on allocation, and
kfree(NULL or (void *)0) is okay to do.


> Signed-off-by: Dheepthi K <dheepthi.s@...celabs.com>
> ---
> drivers/block/nvme-core.c |    7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index 683dff2..9bac53b 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -2947,11 +2947,11 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> 	dev->entry = kzalloc_node(num_possible_cpus() * sizeof(*dev->entry),
> 							GFP_KERNEL, node);
> 	if (!dev->entry)
> -		goto free;
> +		goto free_dev;
> 	dev->queues = kzalloc_node((num_possible_cpus() + 1) * sizeof(void *),
> 							GFP_KERNEL, node);
> 	if (!dev->queues)
> -		goto free;
> +		goto free_entry;
>
> 	INIT_LIST_HEAD(&dev->namespaces);
> 	dev->reset_workfn = nvme_reset_failed_dev;
> @@ -2987,9 +2987,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> 	nvme_release_instance(dev);
>  put_pci:
> 	pci_dev_put(dev->pci_dev);
> - free:
> 	kfree(dev->queues);
> + free_entry:
> 	kfree(dev->entry);
> + free_dev:
> 	kfree(dev);
> 	return result;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ