krishnanadh / rpms / rasdaemon

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