Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Carles Pey <[email protected]>
  • Loading branch information
cpey committed Apr 24, 2024
1 parent eaad11a commit 49eebf8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chipsec/modules/tools/smm/smm_ptr.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def update(self, value, code, data, gprs):
self.data = data

def get_info(self):
if self.code == None:
if self.code is None:
return None
else:
return f"duration {self.duration} code {self.code:02X} data {self.data:02X} ({gprs_info(self.gprs)})"
Expand Down Expand Up @@ -484,7 +484,7 @@ def test_config(self, thread_id, _smi_config_fname, _addr, _addr1):
for line in fcfg:
if '' == line.strip():
self.logger.log(f'\n[*] Testing SMI# 0x{_smi_desc.smi_code:02X} (data: 0x{_smi_desc.smi_data:02X}) {_smi_desc.name} ({_smi_desc.desc})')
if selfsmi_fuzz_iter(thread_id, _addr, _smi_desc):
if self.smi_fuzz_iter(thread_id, _addr, _smi_desc):
bad_ptr_cnt += 1
_smi_desc = None
_smi_desc = smi_desc()
Expand Down Expand Up @@ -608,7 +608,7 @@ def test_fuzz(self, thread_id, smic_start, smic_end, _addr, _addr1, scan_mode=Tr
if scan and scan.skip():
break
if scan_mode:
msg = scan.log_smi_result(self.logger)
scan.log_smi_result(self.logger)
scan.clear()

return bad_ptr_cnt, scan
Expand Down Expand Up @@ -709,12 +709,13 @@ def run(self, module_argv):
bad_ptr_cnt, _ = self.test_fuzz(thread_id, smic_start, smic_end, _addr, _addr1)
elif test_mode in ['scan']:
scan_mode = True
scan = None
bad_ptr_cnt, scan = self.test_fuzz(thread_id, smic_start, smic_end, _addr, _addr1, True)
except BadSMIDetected as msg:
bad_ptr_cnt = 1
self.logger.log_important("Potentially bad SMI detected! Stopped fuzing (see FUZZ_BAIL_ON_1ST_DETECT option)")

if scan_mode:
if scan_mode and scan:
self.logger.log_good(f'<<< Done: found {scan.get_total_outliers()} long-running SMIs')
if bad_ptr_cnt > 0:
self.logger.log_bad(f'<<< Done: found {bad_ptr_cnt:d} potential occurrences of unchecked input pointers')
Expand Down

0 comments on commit 49eebf8

Please sign in to comment.