On 03/01/2018 04:06 PM, John Paul Adrian Glaubitz wrote:
Let me test a patch.

The problem is that of_path is empty here and the strcat tries
to append "disk" to an empty buffer which fails.

This fixes it for me:

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

root@trlin:..glaubitz/grub> ./grub-probe --device /dev/nvme0n1 
--target=hints_string
--hint-ieee1275='ieee1275//disk@1'
root@trlin:..glaubitz/grub>

I'll send a patch upstream.

Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Reply via email to