dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0054-grub-core-disk-ahci.c-Properly-handle-transactions-w.patch

23d2ea
From d0c3c16e995308838d724775cd8624a69907046e Mon Sep 17 00:00:00 2001
39700a
From: Vladimir Serbinenko <phcoder@gmail.com>
39700a
Date: Wed, 29 Jan 2014 23:49:51 +0100
23d2ea
Subject: [PATCH 054/198] * grub-core/disk/ahci.c: Properly handle transactions
23d2ea
 with no transferred data.
39700a
39700a
---
39700a
 ChangeLog             | 5 +++++
39700a
 grub-core/disk/ahci.c | 7 +++++--
39700a
 2 files changed, 10 insertions(+), 2 deletions(-)
39700a
39700a
diff --git a/ChangeLog b/ChangeLog
39700a
index 15300b0..bc1ab23 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: Properly handle transactions with no
39700a
+	transferred data.
39700a
+
39700a
+2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
39700a
+
39700a
 	* grub-core/disk/ahci.c: Add safety cleanups.
39700a
 
39700a
 2014-01-29  Vladimir Serbinenko  <phcoder@gmail.com>
39700a
diff --git a/grub-core/disk/ahci.c b/grub-core/disk/ahci.c
39700a
index 643e691..fdd40c6 100644
39700a
--- a/grub-core/disk/ahci.c
39700a
+++ b/grub-core/disk/ahci.c
39700a
@@ -932,7 +932,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
39700a
   if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
39700a
     return grub_error (GRUB_ERR_BUG, "too big data buffer");
39700a
 
39700a
-  bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
39700a
+  if (parms->size)
39700a
+    bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
39700a
+  else
39700a
+    bufc = grub_memalign_dma32 (1024, 512);
39700a
 
39700a
   grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n",
39700a
 		dev->hba->ports[dev->port].task_file_data,
39700a
@@ -942,7 +945,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
39700a
     = (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT)
39700a
     //    | GRUB_AHCI_CONFIG_CLEAR_R_OK
39700a
     | (0 << GRUB_AHCI_CONFIG_PMP_SHIFT)
39700a
-    | (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
39700a
+    | ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
39700a
     | (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0)
39700a
     | (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ)
39700a
     | (parms->taskfile.cmd == 8 ? (1 << 8) : 0);
39700a
-- 
23d2ea
2.7.4
39700a