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]
Message-Id: <1410512684-17403-2-git-send-email-abbotti@mev.co.uk>
Date:	Fri, 12 Sep 2014 10:04:42 +0100
From:	Ian Abbott <abbotti@....co.uk>
To:	driverdev-devel@...uxdriverproject.org
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Ian Abbott <abbotti@....co.uk>,
	H Hartley Sweeten <hartleys@...ionengravers.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/3] staging: comedi: adl_pci9118: don't allocate 2nd DMA buffer on failure

`pci9118_alloc_dma()` tries to allocate two DMA buffers but may allocate
a single buffer or none at all.  If it fails to allocate the first
buffer, it still tries to allocate the second buffer, even though it
won't be used.  Change it to not bother trying to allocate the second
buffer if the first one fails.

Signed-off-by: Ian Abbott <abbotti@....co.uk>
---
 drivers/staging/comedi/drivers/adl_pci9118.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
index 8d3f813..1169104 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -1489,16 +1489,16 @@ static void pci9118_alloc_dma(struct comedi_device *dev)
 			if (dmabuf->virt)
 				break;
 		}
-		if (dmabuf->virt) {
-			dmabuf->pages = pages;
-			dmabuf->size = PAGE_SIZE * pages;
-			dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
-
-			if (i == 0)
-				devpriv->master = 1;
-			if (i == 1)
-				devpriv->dma_doublebuf = 1;
-		}
+		if (!dmabuf->virt)
+			break;
+		dmabuf->pages = pages;
+		dmabuf->size = PAGE_SIZE * pages;
+		dmabuf->hw = virt_to_bus((void *)dmabuf->virt);
+
+		if (i == 0)
+			devpriv->master = 1;
+		if (i == 1)
+			devpriv->dma_doublebuf = 1;
 	}
 }
 
-- 
2.1.0

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