mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-22 09:34:52 +02:00
PR review fixes: Use contextlib.suppress() instead of an empty exception handler
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
import math
|
||||
import contextlib
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Iterator, List, Tuple, Optional, Union
|
||||
|
||||
@@ -676,15 +677,13 @@ class RadixTree(Tree):
|
||||
return self.RADIX_TREE_INTERNAL_NODE
|
||||
|
||||
def get_tree_height(self, treep) -> int:
|
||||
try:
|
||||
with contextlib.suppress(exceptions.SymbolError):
|
||||
if self.vmlinux.get_type("radix_tree_root").has_member("height"):
|
||||
# kernels < 4.7.10
|
||||
radix_tree_root = self.vmlinux.object(
|
||||
"radix_tree_root", offset=treep, absolute=True
|
||||
)
|
||||
return radix_tree_root.height
|
||||
except exceptions.SymbolError:
|
||||
pass
|
||||
|
||||
# kernels >= 4.7.10
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user