git: aa1eb6233890 - main - linuxkpi: Avoid a potential null pointer dereference in an error path

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 15 Jan 2026 14:18:57 UTC
The branch main has been updated by markj:

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

commit aa1eb623389008c95b897976f4d28a7fe0acd93c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-01-15 13:51:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-01-15 13:51:17 +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
---
 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);
 	}