krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0033-rasdaemon-correct-range-while-parsing-top-middle-and.patch

ac32bf
From 5ba31285710e85c7d3688e536cd54180321964e4 Mon Sep 17 00:00:00 2001
ac32bf
From: Aristeu Rozanski <arozansk@redhat.com>
ac32bf
Date: Mon, 23 Jun 2014 16:31:50 -0400
ac32bf
Subject: [PATCH 2/2] rasdaemon: correct range while parsing top, middle and lower layers
ac32bf
ac32bf
{top,middle,lower}_layer are signed char, therefore will never be 255.
ac32bf
ac32bf
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1035746
ac32bf
ac32bf
Reported-by: Florian Weimer <fweimer@redhat.com>
ac32bf
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
ac32bf
---
ac32bf
 ras-mc-handler.c |   14 +++-----------
ac32bf
 1 file changed, 3 insertions(+), 11 deletions(-)
ac32bf
ac32bf
--- upstream.orig/ras-mc-handler.c	2014-06-26 16:09:30.000000000 -0400
ac32bf
+++ upstream/ras-mc-handler.c	2014-06-26 16:09:32.000000000 -0400
ac32bf
@@ -120,25 +120,17 @@ if (pevent_get_field_val(s,  event, "mc_
ac32bf
 	if (pevent_get_field_val(s,  event, "top_layer", record, &val, 1) < 0)
ac32bf
 		goto parse_error;
ac32bf
 	parsed_fields++;
ac32bf
+	ev.top_layer = (signed char) val;
ac32bf
 
ac32bf
-	ev.top_layer = (int) val;
ac32bf
 	if (pevent_get_field_val(s,  event, "middle_layer", record, &val, 1) < 0)
ac32bf
 		goto parse_error;
ac32bf
 	parsed_fields++;
ac32bf
+	ev.middle_layer = (signed char) val;
ac32bf
 
ac32bf
-	ev.middle_layer = (int) val;
ac32bf
 	if (pevent_get_field_val(s,  event, "lower_layer", record, &val, 1) < 0)
ac32bf
 		goto parse_error;
ac32bf
 	parsed_fields++;
ac32bf
-
ac32bf
-	ev.lower_layer = (int) val;
ac32bf
-
ac32bf
-	if (ev.top_layer == 255)
ac32bf
-		ev.top_layer = -1;
ac32bf
-	if (ev.middle_layer == 255)
ac32bf
-		ev.middle_layer = -1;
ac32bf
-	if (ev.lower_layer == 255)
ac32bf
-		ev.lower_layer = -1;
ac32bf
+	ev.lower_layer = (signed char) val;
ac32bf
 
ac32bf
 	if (ev.top_layer >= 0 || ev.middle_layer >= 0 || ev.lower_layer >= 0) {
ac32bf
 		if (ev.lower_layer >= 0)