Skip to contentSkip to conversation

libibmad/[register rpc].c: Fix some bounds checks

PATCH Applied Hal Rosenstock 2 participants 2 messages Jun 1, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libibmad/[register rpc].c: Fix some bounds checks

---

src/register.c +1 -1
index 0ff8006..1fdb64a 100644
@@ -77,7 +77,7 @@ static int mgmt_class_vers(int mgmt_class)
 
 int mad_class_agent(int mgmt)
 {
-	if (mgmt < 1 || mgmt > MAX_CLASS)
+	if (mgmt < 1 || mgmt >= MAX_CLASS)
 		return -1;
 	return ibmp->class_agents[mgmt];
 }
src/rpc.c +1 -1
index 88e43e7..d20c321 100644
@@ -120,7 +120,7 @@ int mad_rpc_portid(struct ibmad_port *srcport)
 
 int mad_rpc_class_agent(struct ibmad_port *port, int class)
 {
-	if (class < 1 || class > MAX_CLASS)
+	if (class < 1 || class >= MAX_CLASS)
 		return -1;
 	return port->class_agents[class];
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#2 lore raw
In reply to a message not in the archive
Quoted 2 lines · On Wed, 1 Jun 2011 06:45:57 -0700 Hal Rosenstock…

Thanks, applied,
Ira

Quoted 27 lines

---

src/register.c +1 -1
index 0ff8006..1fdb64a 100644
@@ -77,7 +77,7 @@ static int mgmt_class_vers(int mgmt_class)
 
 int mad_class_agent(int mgmt)
 {
-	if (mgmt < 1 || mgmt > MAX_CLASS)
+	if (mgmt < 1 || mgmt >= MAX_CLASS)
 		return -1;
 	return ibmp->class_agents[mgmt];
 }
src/rpc.c +1 -1
index 88e43e7..d20c321 100644
@@ -120,7 +120,7 @@ int mad_rpc_portid(struct ibmad_port *srcport)
 
 int mad_rpc_class_agent(struct ibmad_port *port, int class)
 {
-	if (class < 1 || class > MAX_CLASS)
+	if (class < 1 || class >= MAX_CLASS)
 		return -1;
 	return port->class_agents[class];
 }
Signature · 9 lines
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html