Blame SOURCES/0052-grub-core-disk-ahci.c-Allocate-and-clean-space-for-a.patch

f731ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f731ee
From: Vladimir Serbinenko <phcoder@gmail.com>
f731ee
Date: Wed, 29 Jan 2014 23:45:18 +0100
f731ee
Subject: [PATCH] * grub-core/disk/ahci.c: Allocate and clean space for all
f731ee
 possible 32 slots to avoid pointing to uninited area.
f731ee
f731ee
---
f731ee
 grub-core/disk/ahci.c | 8 +++++++-
f731ee
 ChangeLog             | 5 +++++
f731ee
 2 files changed, 12 insertions(+), 1 deletion(-)
f731ee
f731ee
diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
f731ee
index 18c13270c65..d63fd09fdc6 100644
f731ee
--- a/grub-core/disk/ahci.c
f731ee
+++ b/grub-core/disk/ahci.c
f731ee
@@ -358,7 +358,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
f731ee
 	grub_dprintf ("ahci", "err: %x\n",
f731ee
 		      adevs[i]->hba->ports[adevs[i]->port].sata_error);
f731ee
 
f731ee
-	adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head));
f731ee
+	adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32);
f731ee
 	if (!adevs[i]->command_list_chunk)
f731ee
 	  {
f731ee
 	    adevs[i] = 0;
f731ee
@@ -376,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev,
f731ee
 
f731ee
 	adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk);
f731ee
 	adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk);
f731ee
+
f731ee
+	grub_memset ((void *) adevs[i]->command_list, 0,
f731ee
+		     sizeof (struct grub_ahci_cmd_table));
f731ee
+	grub_memset ((void *) adevs[i]->command_table, 0,
f731ee
+		     sizeof (struct grub_ahci_cmd_head) * 32);
f731ee
+
f731ee
 	adevs[i]->command_list->command_table_base
f731ee
 	  = grub_dma_get_phys (adevs[i]->command_table_chunk);
f731ee
 
f731ee
diff --git a/ChangeLog b/ChangeLog
f731ee
index 51eba95f36f..9bb18177793 100644
f731ee
--- a/ChangeLog
f731ee
+++ b/ChangeLog
f731ee
@@ -1,3 +1,8 @@
f731ee
+2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
f731ee
+
f731ee
+	* grub-core/disk/ahci.c: Allocate and clean space for all possible 32
f731ee
+	slots to avoid pointing to uninited area.
f731ee
+
f731ee
 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
f731ee
 
f731ee
 	* grub-core/disk/ahci.c: Do not enable I/O decoding and keep