From 02b11b44a28634c230b0676bf4feafe37fac6dff Mon Sep 17 00:00:00 2001 From: j-t-1 <120829237+j-t-1@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:59:58 +0000 Subject: [PATCH 1/2] Remove use of int function after math.ceil Return type of math.ceil is already an int. --- volatility3/framework/layers/intel.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/volatility3/framework/layers/intel.py b/volatility3/framework/layers/intel.py index c30ae48a8..846f246dc 100644 --- a/volatility3/framework/layers/intel.py +++ b/volatility3/framework/layers/intel.py @@ -73,8 +73,8 @@ class Intel(linear.LinearlyMappedLayer): ) # These can vary depending on the type of space - self._index_shift = int( - math.ceil(math.log2(struct.calcsize(self._entry_format))) + self._index_shift = math.ceil( + math.log2(struct.calcsize(self._entry_format)) ) @classproperty @@ -125,7 +125,6 @@ class Intel(linear.LinearlyMappedLayer): high_mask = (1 << (high_bit + 1)) - 1 low_mask = (1 << low_bit) - 1 mask = high_mask ^ low_mask - # print(high_bit, low_bit, bin(mask), bin(value)) return value & mask @staticmethod @@ -147,7 +146,7 @@ class Intel(linear.LinearlyMappedLayer): return self._mask(addr, self._maxvirtaddr, 0) + self._canonical_prefix def decanonicalize(self, addr: int) -> int: - """Removes canonicalization to ensure an adress fits within the correct range if it has been canonicalized + """Removes canonicalization to ensure an address fits within the correct range if it has been canonicalized This will produce an address outside the range if the canonicalization is incorrect """ From b37923c183bec9a6381d5d592b405a9fcf51887f Mon Sep 17 00:00:00 2001 From: j-t-1 <120829237+j-t-1@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:08:37 +0000 Subject: [PATCH 2/2] Remove use of int function after math.ceil Return type of math.ceil is already an int. --- volatility3/framework/layers/intel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/volatility3/framework/layers/intel.py b/volatility3/framework/layers/intel.py index 846f246dc..7918ebed4 100644 --- a/volatility3/framework/layers/intel.py +++ b/volatility3/framework/layers/intel.py @@ -73,9 +73,7 @@ class Intel(linear.LinearlyMappedLayer): ) # These can vary depending on the type of space - self._index_shift = math.ceil( - math.log2(struct.calcsize(self._entry_format)) - ) + self._index_shift = math.ceil(math.log2(struct.calcsize(self._entry_format))) @classproperty @functools.lru_cache()