]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/disk/ahci.c: Allocate and clean space for all possible 32
authorVladimir Serbinenko <phcoder@gmail.com>
Wed, 29 Jan 2014 22:45:18 +0000 (23:45 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 29 Jan 2014 22:45:18 +0000 (23:45 +0100)
slots to avoid pointing to uninited area.

ChangeLog
grub-core/disk/ahci.c

index 8c374506529b3cd2135f1bd934064e7db3bbad6d..b2b54b95224327a8f3d9d201d40bedc3887824c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/disk/ahci.c: Allocate and clean space for all possible 32
+       slots to avoid pointing to uninited area.
+
 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/disk/ahci.c: Do not enable I/O decoding and keep
index 18c13270c65b40242fb7f4b2717c5badd2268a46..d63fd09fdc628ec04fd752b239eba115a418b2a1 100644 (file)
@@ -358,7 +358,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
        grub_dprintf ("ahci", "err: %x\n",
                      adevs[i]->hba->ports[adevs[i]->port].sata_error);
 
-       adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head));
+       adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32);
        if (!adevs[i]->command_list_chunk)
          {
            adevs[i] = 0;
@@ -376,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev,
 
        adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk);
        adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk);
+
+       grub_memset ((void *) adevs[i]->command_list, 0,
+                    sizeof (struct grub_ahci_cmd_table));
+       grub_memset ((void *) adevs[i]->command_table, 0,
+                    sizeof (struct grub_ahci_cmd_head) * 32);
+
        adevs[i]->command_list->command_table_base
          = grub_dma_get_phys (adevs[i]->command_table_chunk);