Except for this one place, the rest of the code can deal with cdev links to non-partitions. Switch the function over to use streq_ptr, so we can use cdev master links without risking a NULL pointer dereference.
Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> --- fs/devfs-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/devfs-core.c b/fs/devfs-core.c index e32bce9e307e..04bf866a67e0 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -192,13 +192,11 @@ struct cdev *device_find_partition(struct device *dev, const char *name) list_for_each_entry(cdev, &dev->cdevs, devices_list) { struct cdev *cdevl; - if (!cdev->partname) - continue; - if (!strcmp(cdev->partname, name)) + if (streq_ptr(cdev->partname, name)) return cdev; list_for_each_entry(cdevl, &cdev->links, link_entry) { - if (!strcmp(cdevl->partname, name)) + if (streq_ptr(cdevl->partname, name)) return cdev_readlink(cdevl); } } -- 2.39.5