diff mbox

[opensm] osm_sa_guidinfo_record.c: Fix crash when receiving AGUID SET/DELETE with block_num equal to max_block

Message ID 538C4F46.3070607@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Hal Rosenstock
Headers show

Commit Message

Hal Rosenstock June 2, 2014, 10:17 a.m. UTC
From: Vladimir Koushnir <vladimirk@mellanox.com>

Signed-off-by: Vladimir Koushnir <vladimirk@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 opensm/osm_sa_guidinfo_record.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/opensm/osm_sa_guidinfo_record.c b/opensm/osm_sa_guidinfo_record.c
index 1ad8cad..d96db54 100644
--- a/opensm/osm_sa_guidinfo_record.c
+++ b/opensm/osm_sa_guidinfo_record.c
@@ -396,7 +396,7 @@  static void del_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
 	max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) /
 		     GUID_TABLE_MAX_ENTRIES;
 
-	if (block_num > max_block) {
+	if (block_num >= max_block) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5116: "
 			"block_num %d is higher than Max GUID Cap block %d "
 			"for port GUID 0x%" PRIx64 "\n",
@@ -503,7 +503,7 @@  static void set_guidinfo(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
 
 	max_block = (p_port->p_physp->port_info.guid_cap + GUID_TABLE_MAX_ENTRIES - 1) /
 		     GUID_TABLE_MAX_ENTRIES;
-	if (block_num > max_block) {
+	if (block_num >= max_block) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5118: "
 			"block_num %d is higher than Max GUID Cap block %d "
 			"for port GUID 0x%" PRIx64 "\n",