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

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