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

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