git: cb9ef3a7034a - stable/14 - kboot: Use is_linux_error to check mmap return error

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 16 Apr 2024 20:13:35 UTC
The branch stable/14 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb9ef3a7034a05fd09241867b092ebe6097097f1

commit cb9ef3a7034a05fd09241867b092ebe6097097f1
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-03-11 20:15:39 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-16 19:54:29 +0000

    kboot: Use is_linux_error to check mmap return error
    
    Rather than checking against the (incorrect) -511, use the
    is_linux_error() function to check to see if host_mmap failed.
    
    Sponsored by:           Netflix
    
    (cherry picked from commit d75524b3fe21752b233f66ae8e9d6450d507f75c)
---
 stand/kboot/kboot/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/kboot/kboot/main.c b/stand/kboot/kboot/main.c
index c397e573fc75..e57446baa47d 100644
--- a/stand/kboot/kboot/main.c
+++ b/stand/kboot/kboot/main.c
@@ -232,7 +232,7 @@ caddr_t ptov(uintptr_t pa)
 	 * the raw system call we have to do that ourselves.
 	 */
 	va = host_mmap(0, PAGE, HOST_PROT_READ, HOST_MAP_SHARED, smbios_fd, pa2);
-	if ((intptr_t)va < 0 && (intptr_t)va >= -511)
+	if (is_linux_error((long)va))
 		panic("smbios mmap offset %#jx failed", (uintmax_t)pa2);
 	m = &map[nmap++];
 	m->pa = pa2;