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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 Nov 2015 02:24:34 -0800
From:	Joe Perches <joe@...ches.com>
To:	Ching Huang <ching2048@...ca.com.tw>
Cc:	hch@...radead.org, thenzl@...hat.com, jbottomley@...allels.com,
	dan.carpenter@...cle.com, agordeev@...hat.com,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
	hch@....de
Subject: Re: [PATCH 2/2] arcmsr: adds code for support areca new adapter
 ARC1203

On Tue, 2015-11-24 at 17:53 +0800, Ching Huang wrote:
> On Tue, 2015-11-24 at 01:33 -0800, Joe Perches wrote:
> > On Tue, 2015-11-24 at 16:17 +0800, Ching Huang wrote:
> > > From: Ching Huang <ching2048@...ca.com.tw>
> > > 
> > > Support areca new PCIe to SATA RAID adapter ARC1203
> > 
> > Why add the dma_free_coherent to an old data path?
> > Is that a general bug fix that should be backported?
> 
> That's right. It's need to release the allocated resource for failed
> condition.

Then the dma_free_coherent addition should be a separate patch.

Style trivia:

The goto to another error path like that is odd and
the label is unintelligible.

Ideally error condition handling would use a goto and
a separate and obviously named label.  Use multiple
labels for cases with more complicated unwinding.

Dan Carpenter has written about this several times.

For this use, something like:

	writel(ARCMSR_MESSAGE_START_DRIVER_MODE, reg->drv2iop_doorbell);
	if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
		logging_message(...);
		goto
err_free_resource;
	}
	writel(ARCMSR_MESSAGE_GET_CONFIG, reg->drv2iop_doorbell);
	if (!arcmsr_hbaB_wait_msgint_ready(acb)) {
		logging_message(...);
		goto err_free_resource;
	}

	[success path...]

	return true;

err_free_resource:
	dma_free_coherent(...);

	return false;
}

--
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