[ofa-general] [PATCH 2/5] [DAPL v2] fix off-by-one with ia handle

Patrick Marchand Latifi patrick.latifi at qlogic.com
Wed Feb 13 15:00:12 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 cb4105d..693fa30 100755
--- a/dat/common/dat_api.c
+++ b/dat/common/dat_api.c
@@ -185,7 +185,7 @@ dats_get_ia_handle(
 {
     DAT_RETURN		dat_status;
 
-    if (DAT_IA_HANDLE_TO_UL(handle) > g_hv.handle_max)
+    if (DAT_IA_HANDLE_TO_UL(handle) >= g_hv.handle_max)
     {
 	dat_status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
 	goto bail;
@@ -228,7 +228,7 @@ dats_is_ia_handle (
 {
     unsigned long handle = DAT_IA_HANDLE_TO_UL((DAT_IA_HANDLE)dat_handle);
 
-    if (g_hv.handle_max < handle )
+    if (g_hv.handle_max <= handle )
     {
 	return DAT_FALSE;
     }
@@ -254,7 +254,7 @@ dats_free_ia_handle (
 {
     DAT_RETURN		dat_status;
 
-    if (DAT_IA_HANDLE_TO_UL(handle) > g_hv.handle_max)
+    if (DAT_IA_HANDLE_TO_UL(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