[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Protect against false-positives in devicetree's device lookup methods.
- From: David Lehman <dlehman redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Protect against false-positives in devicetree's device lookup methods.
- Date: Tue, 30 Jun 2009 18:08:10 -0500
---
storage/devicetree.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index ddbe917..8668ebd 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1787,6 +1787,9 @@ class DeviceTree(object):
log.debug("setup of %s failed: %s" % (device.name, msg))
def getDeviceBySysfsPath(self, path):
+ if not path:
+ return None
+
found = None
for device in self._devices:
if device.sysfsPath == path:
@@ -1796,6 +1799,9 @@ class DeviceTree(object):
return found
def getDeviceByUuid(self, uuid):
+ if not uuid:
+ return None
+
found = None
for device in self._devices:
if device.uuid == uuid:
@@ -1808,6 +1814,9 @@ class DeviceTree(object):
return found
def getDeviceByLabel(self, label):
+ if not label:
+ return None
+
found = None
for device in self._devices:
_label = getattr(device.format, "label", None)
@@ -1822,6 +1831,9 @@ class DeviceTree(object):
def getDeviceByName(self, name):
log.debug("looking for device '%s'..." % name)
+ if not name:
+ return None
+
found = None
for device in self._devices:
if device.name == name:
--
1.6.0.6
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]