From 2e085395e1994a96601abeda4b03ec9455b4d2d4 Mon Sep 17 00:00:00 2001 From: Mitchell Horne Date: Mon, 30 Nov 2020 22:16:11 +0000 Subject: [PATCH] efibootmgr: fix an incorrect error handling check efivar_device_path_to_unix_path() returns standard error codes on failure and zero on success. Checking for a return value less than zero means that the actual failure cases won't be handled. This could manifest as a segfault during the subsequent call to printf(). Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D27424 --- usr.sbin/efibootmgr/efibootmgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index e12f869bd4b..8c7ba82cb5a 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -1034,7 +1034,7 @@ report_esp_device(bool do_dp, bool do_unix) printf("%s\n", buf); exit(0); } - if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) < 0) + if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) != 0) errx(1, "Can't convert to unix path"); if (do_unix) { if (abspath == NULL)