From d7f7d6ce883ec465d92a2e5b7bc84dec5f15518d Mon Sep 17 00:00:00 2001 From: Quentin Minster Date: Mon, 29 Mar 2021 22:54:12 +0200 Subject: [PATCH] Check the VID is present in the chipset dictionary On some platforms (e.g. VirtualBox) where there is no PCI device at `00:00.0`, VID/DID reads for platform detection return `0xFFFF`. --- chipsec/chipset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chipsec/chipset.py b/chipsec/chipset.py index 8ffdbf81..43145c53 100644 --- a/chipsec/chipset.py +++ b/chipsec/chipset.py @@ -234,7 +234,7 @@ class Chipset: if platform_code is None: #platform code was not passed in try to determine based upon cpu id - if did in self.chipset_dictionary[vid] and len(self.chipset_dictionary[vid][did]) > 1 and cpuid in self.detection_dictionary.keys(): + if vid in self.chipset_dictionary and did in self.chipset_dictionary[vid] and len(self.chipset_dictionary[vid][did]) > 1 and cpuid in self.detection_dictionary.keys(): for item in self.chipset_dictionary[vid][did]: if self.detection_dictionary[cpuid] == item['code']: #matched processor with detection value @@ -246,7 +246,7 @@ class Chipset: self.did = did self.rid = rid break - elif did in self.chipset_dictionary[vid]: + elif vid in self.chipset_dictionary and did in self.chipset_dictionary[vid]: _unknown_platform = False data_dict = self.chipset_dictionary[vid][ did ][0] self.code = data_dict['code'].upper()