krishnanadh / rpms / rasdaemon

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