Blame SOURCES/0092-utils-boot-analysis-Make-insmod-message-handling-a-b.patch

e76f14
From 50bcb7aa73d899dda1a994d3ed8e4cab83c6678a Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Tue, 17 May 2016 15:34:42 +0100
e76f14
Subject: [PATCH] utils: boot-analysis: Make insmod message handling a bit more
e76f14
 robust.
e76f14
e76f14
(cherry picked from commit 613fe4c089d132d63edddf1ccb53c082c20aded3)
e76f14
---
e76f14
 utils/boot-analysis/boot-analysis-timeline.c | 11 +++++++++--
e76f14
 1 file changed, 9 insertions(+), 2 deletions(-)
e76f14
e76f14
diff --git a/utils/boot-analysis/boot-analysis-timeline.c b/utils/boot-analysis/boot-analysis-timeline.c
e76f14
index a4b71a1..8198c56 100644
e76f14
--- a/utils/boot-analysis/boot-analysis-timeline.c
e76f14
+++ b/utils/boot-analysis/boot-analysis-timeline.c
e76f14
@@ -48,13 +48,20 @@ static void construct_initcall_timeline (void);
e76f14
 static char *
e76f14
 translate_supermin_insmod_message (const char *message)
e76f14
 {
e76f14
+  const char *p, *q;
e76f14
   char *ret;
e76f14
 
e76f14
   assert (STRPREFIX (message, "supermin: internal "));
e76f14
+  p = message       + strlen ("supermin: internal ");
e76f14
 
e76f14
-  ret = strdup (message + strlen ("supermin: internal "));
e76f14
+  /* Strip off the .ko and anything that follows. */
e76f14
+  q = strstr (p, ".ko");
e76f14
+  if (q == NULL)
e76f14
+    error (EXIT_FAILURE, 0, "cannot find '.ko' suffix in '%s'", message);
e76f14
+
e76f14
+  ret = strndup (p, q-p);
e76f14
   if (ret == NULL)
e76f14
-    error (EXIT_FAILURE, errno, "strdup");
e76f14
+    error (EXIT_FAILURE, errno, "strndup");
e76f14
   return ret;
e76f14
 }
e76f14
 
e76f14
-- 
e76f14
1.8.3.1
e76f14