linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ata: ahci_xgene: dereferencing uninitialized pointer in probe
@ 2016-03-10  7:45 Dan Carpenter
  2016-03-11 17:41 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-03-10  7:45 UTC (permalink / raw)
  To: Tejun Heo, Suman Tripathi; +Cc: linux-ide, linux-kernel, kernel-janitors

If the call to acpi_get_object_info() fails then "info" hasn't been
initialized.  In that situation, we already know that "version" should
be XGENE_AHCI_V1 so we don't actually need to dereference "info".

Fixes: c9802a4be661 ('ata: ahci_xgene: Add AHCI Support for 2nd HW version of APM X-Gene SoC AHCI SATA Host controller.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 8e3f7fa..73b19b2 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -821,9 +821,9 @@ static int xgene_ahci_probe(struct platform_device *pdev)
 				dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n",
 					__func__);
 				version = XGENE_AHCI_V1;
-			}
-			if (info->valid & ACPI_VALID_CID)
+			} else if (info->valid & ACPI_VALID_CID) {
 				version = XGENE_AHCI_V2;
+			}
 		}
 	}
 #endif

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ata: ahci_xgene: dereferencing uninitialized pointer in probe
  2016-03-10  7:45 [patch] ata: ahci_xgene: dereferencing uninitialized pointer in probe Dan Carpenter
@ 2016-03-11 17:41 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2016-03-11 17:41 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Suman Tripathi, linux-ide, linux-kernel, kernel-janitors

On Thu, Mar 10, 2016 at 10:45:32AM +0300, Dan Carpenter wrote:
> If the call to acpi_get_object_info() fails then "info" hasn't been
> initialized.  In that situation, we already know that "version" should
> be XGENE_AHCI_V1 so we don't actually need to dereference "info".
> 
> Fixes: c9802a4be661 ('ata: ahci_xgene: Add AHCI Support for 2nd HW version of APM X-Gene SoC AHCI SATA Host controller.')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to libata/for-4.6.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-11 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10  7:45 [patch] ata: ahci_xgene: dereferencing uninitialized pointer in probe Dan Carpenter
2016-03-11 17:41 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).