diff mbox series

ata: Prevent null dereference in ata_host_alloc_pinfo

Message ID 1519319271-30139-1-git-send-email-benjamin.bales@assrc.us
State Not Applicable
Delegated to: David Miller
Headers show
Series ata: Prevent null dereference in ata_host_alloc_pinfo | expand

Commit Message

Code AI Feb. 22, 2018, 5:07 p.m. UTC
Hi my name is Benjamin Bales.

I am the founder and creator of CodeAI,
the first non-human contributor to your software project. CodeAI finds
and fixes security defects for you. It fixed 327. It wants to merge a
null pointer dereference fix. To view all 327 fixed issues from the
run claim your free open source account at mycode.aiand the Dockerfile
used to build and run your project in CodeAI, here-
https://drive.google.com/drive/folders/1KB9WQQyWQgYccmiSjy2E1JWJ4vWuoLYd .
It is always free for open source projects.

If you have any questions about these results or have general
inquiries about CodeAI, please send an email to techsupport@mycode.ai

Signed-off-by: Benjamin Bales <techsupport@mycode.ai>
---
 drivers/ata/libata-core.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3c09122..e0b0df7 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6129,6 +6129,9 @@  struct ata_host *ata_host_alloc_pinfo(struct device *dev,
 		if (ppi[j])
 			pi = ppi[j++];
 
+		if (pi == NULL)
+			break;
+
 		ap->pio_mask = pi->pio_mask;
 		ap->mwdma_mask = pi->mwdma_mask;
 		ap->udma_mask = pi->udma_mask;