[Bug 263396] Fix a possible NULL pointer dereference bug in ocs_hw_setup()

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 18 Apr 2022 16:20:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263396

            Bug ID: 263396
           Summary: Fix a possible NULL pointer dereference bug in
                    ocs_hw_setup()
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: zhou1615@umn.edu

Created attachment 233305
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=233305&action=edit
A possible fix for this bug

The function ocs_hw_qtop_parse() could return NULL on malloc failure.
However the caller function ocs_hw_setup() of ocs_hw_qtop_parse()
uses the return value without check, which could lead to NULL pointer 
dereference.

Fix this by adding a NULL check.

this patch is a possible fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.