git: a3b3be585f7e - stable/15 - linuxkpi: Avoid a potential null pointer dereference in an error path

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 26 Jan 2026 00:52:38 UTC
The branch stable/15 has been updated by markj:

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

commit a3b3be585f7e0cbb9736399172aa72f06161819b
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-01-15 13:51:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-01-26 00:51:44 +0000

    linuxkpi: Avoid a potential null pointer dereference in an error path
    
    Reported by:    Kevin Day <kevin@your.org>
    Reviewed by:    bz, emaste
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D54672
    
    (cherry picked from commit aa1eb623389008c95b897976f4d28a7fe0acd93c)
---
 sys/compat/linuxkpi/common/src/linux_firmware.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c
index 12658df5ce83..0c6d855501ef 100644
--- a/sys/compat/linuxkpi/common/src/linux_firmware.c
+++ b/sys/compat/linuxkpi/common/src/linux_firmware.c
@@ -66,7 +66,8 @@ _linuxkpi_request_firmware(const char *fw_name, const struct linuxkpi_firmware *
 	uint32_t flags;
 
 	if (fw_name == NULL || fw == NULL || dev == NULL) {
-		*fw = NULL;
+		if (fw != NULL)
+			*fw = NULL;
 		return (-EINVAL);
 	}