diff mbox series

ioat: ioat_alloc_ring() failure handling.

Message ID 97d0e388cbf64efe9fad8c340713e4d8@x13pwhopdag1307.AMER.DELL.COM (mailing list archive)
State Superseded
Headers show
Series ioat: ioat_alloc_ring() failure handling. | expand

Commit Message

ALEXANDER BARABASH Dec. 25, 2019, 5:51 p.m. UTC
If dma_alloc_coherent() returns NULL in ioat_alloc_ring(), ring
allocation must not proceed.

Until now, if the first call to dma_alloc_coherent() in
ioat_alloc_ring() returned NULL, the processing could proceed, failing
with NULL-pointer dereferencing further down the line.

Signed-off-by: Alexander Barabash <alexander.barabash@dell.com>
---
 drivers/dma/ioat/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 1a422a8..e1553ae 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -377,7 +377,7 @@  struct ioat_ring_ent **
 
 		descs->virt = dma_alloc_coherent(to_dev(ioat_chan),
 						 SZ_2M, &descs->hw, flags);
-		if (!descs->virt && (i > 0)) {
+		if (!descs->virt) {
 			int idx;
 
 			for (idx = 0; idx < i; idx++) {