opensm: Fix a possible dereference of a NULL pointer

Reported by:	Coverity
Reviewed by:	hselasky, kib
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26233
This commit is contained in:
Eric van Gyzen 2020-08-31 15:26:01 +00:00
parent 5dd47b52e5
commit 24e3300159
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364991

View File

@ -1311,6 +1311,14 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
cl_plock_acquire(&pm->osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
if (!p_node) {
OSM_LOG(pm->log, OSM_LOG_ERROR,
"ERR 5407: Node \"%s\" (guid 0x%" PRIx64
") no longer exists so removing from PerfMgr"
" monitoring\n",
mon_node->name, mon_node->guid);
goto Exit;
}
lid = get_lid(p_node, port, mon_node);
cl_plock_release(&pm->osm->lock);
if (lid == 0) {
@ -1402,6 +1410,14 @@ static void perfmgr_check_pce_overflow(osm_perfmgr_t * pm,
cl_plock_acquire(&pm->osm->lock);
p_node =
osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
if (!p_node) {
OSM_LOG(pm->log, OSM_LOG_ERROR,
"ERR 5407: Node \"%s\" (guid 0x%" PRIx64
") no longer exists so removing from PerfMgr"
" monitoring\n",
mon_node->name, mon_node->guid);
goto Exit;
}
lid = get_lid(p_node, port, mon_node);
cl_plock_release(&pm->osm->lock);
if (lid == 0) {