[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty
From: |
John Paul Adrian Glaubitz |
Subject: |
[PATCH] ieee1275: Fix crash in of_path_of_nvme when of_path is empty |
Date: |
Thu, 1 Mar 2018 16:47:09 +0100 |
The of_path_of_nvme function (commit 2391d57, ieee1275: add nvme
support within ofpath) introduced a functional regression:
On systems where of_path is empty, i.e. non-OpenFirmware
machines, grub-probe crashes in of_path_of_nvme when trying
to append the disk name to an empty of_path.
Signed-off-by: John Paul Adrian Glaubitz <address@hidden>
---
grub-core/osdep/linux/ofpath.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c
index 1c30e7233..da0000f0f 100644
--- a/grub-core/osdep/linux/ofpath.c
+++ b/grub-core/osdep/linux/ofpath.c
@@ -389,8 +389,13 @@ of_path_of_nvme(const char *sys_devname
__attribute__((unused)),
}
of_path = find_obppath (sysfs_path);
+
+ if(of_path)
+ strcat (of_path, disk);
+ else
+ of_path = strdup(disk);
+
free (sysfs_path);
- strcat (of_path, disk);
return of_path;
}
--
2.16.2