[PATCH] Protect against false-positives in devicetree's device lookup methods.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux