[ofa-general] [PATCH 3/6] [DAPL v1] fix off-by-one with ia handle

Patrick Marchand Latifi patrick.latifi at qlogic.com
Wed Feb 13 14:58:03 PST 2008


Make sure we stay within bounds when manipulating the ia handle.

Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---

 dat/common/dat_api.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dat/common/dat_api.c b/dat/common/dat_api.c
index e958c68..2cfa4a3 100644
--- a/dat/common/dat_api.c
+++ b/dat/common/dat_api.c
@@ -176,7 +176,7 @@ dats_get_ia_handle(
 {
     DAT_RETURN		dat_status;
 
-    if (handle > g_hv.handle_max)
+    if (handle >= g_hv.handle_max)
     {
 	dat_status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
 	goto bail;
@@ -219,7 +219,7 @@ dats_is_ia_handle (
 {
     unsigned long handle = (unsigned long) dat_handle;
 
-    if (g_hv.handle_max < handle )
+    if (g_hv.handle_max <= handle )
     {
 	return DAT_FALSE;
     }
@@ -245,7 +245,7 @@ dats_free_ia_handle (
 {
     DAT_RETURN		dat_status;
 
-    if (handle > g_hv.handle_max)
+    if (handle >= g_hv.handle_max)
     {
 	dat_status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
 	goto bail;




More information about the general mailing list