git: ecaeac805b04 - main - mlxfw: fix potential NULL pointer dereference

From: Eric van Gyzen <vangyzen_at_FreeBSD.org>
Date: Tue, 04 Apr 2023 19:28:50 UTC
The branch main has been updated by vangyzen:

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

commit ecaeac805b044f715c98960a8fbf19fe2b76ae6b
Author:     Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2023-03-30 23:27:06 +0000
Commit:     Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2023-04-04 20:27:46 +0000

    mlxfw: fix potential NULL pointer dereference
    
    Reported by:    Coverity (an internal run at Dell)
    Reviewed by:    kib
    MFC after:      1 week
    Sponsored by:   Dell EMC Isilon
    Differential Revision: https://reviews.freebsd.org/D39348
---
 sys/dev/mlxfw/mlxfw_mfa2_tlv_multi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/mlxfw/mlxfw_mfa2_tlv_multi.c b/sys/dev/mlxfw/mlxfw_mfa2_tlv_multi.c
index 1b6080930724..78ddf10f359d 100644
--- a/sys/dev/mlxfw/mlxfw_mfa2_tlv_multi.c
+++ b/sys/dev/mlxfw/mlxfw_mfa2_tlv_multi.c
@@ -60,6 +60,8 @@ mlxfw_mfa2_tlv_next(const struct mlxfw_mfa2_file *mfa2_file,
 
 	if (tlv->type == MLXFW_MFA2_TLV_MULTI_PART) {
 		multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, tlv);
+		if (!multi)
+			return NULL;
 		tlv_len = NLA_ALIGN(tlv_len + be16_to_cpu(multi->total_len));
 	}