File ppc64-diag.rtas_errd-LE-fixes-for-extract_platdump.patch of Package ppc64-diag

From 852c42d36ee94f41d9a314eb7fde7c3486a89ffd Mon Sep 17 00:00:00 2001
From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
Date: Tue, 9 Sep 2014 15:24:49 -0400
Subject: [PATCH 2/3] rtas_errd: LE fixes for extract_platdump

Exit with error when we can't retrieve a dump for an invalid dump ID.

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 rtas_errd/extract_platdump.c | 7 +++++++
 1 file changed, 7 insertions(+)

Index: ppc64-diag-2.6.8/rtas_errd/extract_platdump.c
===================================================================
--- ppc64-diag-2.6.8.orig/rtas_errd/extract_platdump.c
+++ ppc64-diag-2.6.8/rtas_errd/extract_platdump.c
@@ -233,6 +233,13 @@ extract_platform_dump(uint64_t dump_tag)
 		ret = 1;
 		goto platdump_error_out;
 	}
+	/* If we didn't read enough bytes, handle it */
+	if (bytes <= 0) {
+		msg("Platform dump with id: 0x%016LX is either invalid "
+			"or empty\n", dump_tag);
+		ret = 1;
+		goto platdump_error_out;
+	}
 
 	seq = seq_next;
 
openSUSE Build Service is sponsored by