From 1701b0488ec867501dbecf27c618873ef41b1470 Mon Sep 17 00:00:00 2001 From: Monu Surana <msurana@codeaurora.org> Date: Tue, 14 Apr 2015 17:49:01 -0700 Subject: [PATCH] linux-ramdump-parser-v2: Additional corruption checks in timer list Catch TypeError for data values to identify corruptions in timer list Change-Id: I7149fb31c8faacea06355417a3ceb7f531f44b0e Signed-off-by: Monu Surana <msurana@codeaurora.org> --- linux-ramdump-parser-v2/parsers/timerlist.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/linux-ramdump-parser-v2/parsers/timerlist.py b/linux-ramdump-parser-v2/parsers/timerlist.py index 30fe5ee..fd99a59 100755 --- a/linux-ramdump-parser-v2/parsers/timerlist.py +++ b/linux-ramdump-parser-v2/parsers/timerlist.py @@ -9,6 +9,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +import sys import linux_list from print_out import print_out_str from parser_util import register_parser, RamParser @@ -21,7 +22,7 @@ class TimerList(RamParser) : self.vectors = {'tv1': 256, 'tv2': 64, 'tv3': 64, 'tv4': 64, 'tv5': 64} self.output = [] - def timer_list_walker(self, node, index, base): + def timer_list_walker(self, node, type, index, base): if node == self.head: return @@ -33,7 +34,12 @@ class TimerList(RamParser) : function = self.ramdump.unwind_lookup(self.ramdump.read_word(function_addr))[0] expires = self.ramdump.read_word(expires_addr) - data = hex(self.ramdump.read_word(data_addr)).rstrip('L') + try: + data = hex(self.ramdump.read_word(data_addr)).rstrip('L') + except TypeError: + self.output_file.write("+ Corruption detected at index {0} in {1} list, found corrupted value: {2:x}\n".format(index, type, data_addr)) + return + timer_base = self.ramdump.read_word(timer_base_addr) & ~3 if function == "delayed_work_timer_fn": @@ -56,7 +62,7 @@ class TimerList(RamParser) : self.head = index node_offset = self.ramdump.field_offset('struct list_head', 'next') timer_list_walker = linux_list.ListWalker(self.ramdump, index, node_offset) - timer_list_walker.walk(index, self.timer_list_walker, i, base) + timer_list_walker.walk(index, self.timer_list_walker, type, i, base) def print_vec(self, type): if len(self.output): -- GitLab