kern/mips/arc/init: Add missing grub_strdup() failure check

If grub_strdup() fails, it returns NULL and passing NULL further down to
the code can lead to segmentation fault or an undefined behavior.

Signed-off-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Avnish Chouhan authored and Daniel Kiper committed 2025-11-18 12:49:31 +01:00
1 parent 9eebd67744
commit f8c48cbedc
1 file changed
+3
+3
View File
@@ -403,6 +403,9 @@ grub_machine_get_bootlocation (char **device, char **path)
if (!syspart)
return;
loaddev = grub_strdup (syspart);
if (loaddev == NULL)
return;
}
partptr = get_part (loaddev);