Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Feb 2022 07:18:41 GMT
From:      Ram Kishore Vegesna <ram@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9199f5e0ba5c - stable/12 - ocs_fc: Fix a possible Null pointer dereference
Message-ID:  <202202140718.21E7Ifnh032482@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by ram:

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

commit 9199f5e0ba5c20e2f170b549a743a550d9b38ec8
Author:     Ram Kishore Vegesna <ram@FreeBSD.org>
AuthorDate: 2022-02-09 10:14:12 +0000
Commit:     Ram Kishore Vegesna <ram@FreeBSD.org>
CommitDate: 2022-02-14 07:11:11 +0000

    ocs_fc: Fix a possible Null pointer dereference
    
    Fix a possible Null pointer dereference in ocs_hw_get_profile_list_cb()
    
    PR: 261453
    Reported by: lwhsu
    
    MFC after: 3 days
    
    (cherry picked from commit 7bf31432fd03e2a5a815d1cc81de9a7b1ea3d3ca)
---
 sys/dev/ocs_fc/ocs_hw.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c
index d9e8713765a2..7a623478c8aa 100644
--- a/sys/dev/ocs_fc/ocs_hw.c
+++ b/sys/dev/ocs_fc/ocs_hw.c
@@ -7614,6 +7614,11 @@ ocs_hw_get_profile_list_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg
 	int num_descriptors;
 
 	list = ocs_malloc(hw->os, sizeof(ocs_hw_profile_list_t), OCS_M_ZERO);
+	if (list == NULL) {
+		ocs_log_err(hw->os, "failed to malloc list\n");
+		return OCS_HW_RTN_NO_MEMORY;
+	}
+
 	list->num_descriptors = response->profile_descriptor_count;
 
 	num_descriptors = list->num_descriptors;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202140718.21E7Ifnh032482>