All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] ACPI, APEI: Fix incorrect bit width + offset check condition
@ 2012-06-13  7:39 Xiao, Hui
  2012-06-13  8:46 ` Jean Delvare
  0 siblings, 1 reply; 13+ messages in thread
From: Xiao, Hui @ 2012-06-13  7:39 UTC (permalink / raw)
  To: garyhade, tony.luck, ying.huang, lenb, pluto, khali, linux-acpi
  Cc: Xiao, Hui, Chen Gong

Fix the incorrect bit width + offset check condition in apei_check_gar()
function introduced by commit v3.3-5-g15afae6.

The bug caused regression on EINJ error injection with errors:

[Firmware Bug]: APEI: Invalid bit width + offset in GAR [0x1121a5000/64/0/3/0]

on a valid address region of:
    - Register bit width: 64 bits
    - Register bit offset: 0
    - Access Size: 03 [DWord Access: 32]

Signed-off-by: Xiao, Hui <hui.xiao@linux.intel.com>
Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
---
 drivers/acpi/apei/apei-base.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 5577762..95e07b2 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -586,9 +586,12 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
 	}
 	*access_bit_width = 1UL << (access_size_code + 2);
 
-	if ((bit_width + bit_offset) > *access_bit_width) {
+	/* bit_width and bit_offset must be zero when addressing a data
+	 * structure. So just check for non-zero case here */
+	if ((bit_width != 0 && *access_bit_width > bit_width) ||
+			bit_offset > *access_bit_width) {
 		pr_warning(FW_BUG APEI_PFX
-			   "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n",
+			   "Invalid bit width or offset in GAR [0x%llx/%u/%u/%u/%u]\n",
 			   *paddr, bit_width, bit_offset, access_size_code,
 			   space_id);
 		return -EINVAL;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-07-19  0:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13  7:39 [RFC] ACPI, APEI: Fix incorrect bit width + offset check condition Xiao, Hui
2012-06-13  8:46 ` Jean Delvare
2012-06-13 10:44   ` Xiao, Hui
2012-06-14  7:53     ` Jean Delvare
2012-06-14 21:49       ` Gary Hade
2012-06-13 17:45   ` Gary Hade
2012-06-14  6:14     ` Xiao, Hui
2012-06-14  8:09       ` Jean Delvare
2012-06-14 16:32         ` Gary Hade
2012-06-15 11:28           ` Xiao, Hui
2012-07-18  8:24         ` Chen Gong
2012-07-18 14:28           ` Jean Delvare
2012-07-19  0:37             ` Huang Ying

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.