[IBAL] Handle RMPP AttributeOffset = 0.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 14 Nov 2005 18:41:29 +0000 (18:41 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 14 Nov 2005 18:41:29 +0000 (18:41 +0000)
Submitted by Guy Corem (guyc@voltaire.com)

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@151 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/al_query.c

index f6fd620..8dc8898 100644 (file)
@@ -332,9 +332,17 @@ query_req_cb(
                CL_ASSERT( p_mad_response );\r
                p_sa_mad = (ib_sa_mad_t*)p_mad_response->p_mad_buf;\r
 \r
-               query_rec.result_cnt =\r
-                       ( ( p_mad_response->size - IB_SA_MAD_HDR_SIZE ) /\r
-                       ib_get_attr_size( p_sa_mad->attr_offset ) );\r
+               if (ib_get_attr_size( p_sa_mad->attr_offset ) != 0)\r
+               {\r
+                       query_rec.result_cnt =\r
+                               ( ( p_mad_response->size - IB_SA_MAD_HDR_SIZE ) /\r
+                               ib_get_attr_size( p_sa_mad->attr_offset ) );\r
+               }\r
+               else\r
+               {\r
+                       query_rec.result_cnt = 0;\r
+               }\r
+\r
                query_rec.p_result_mad = p_mad_response;\r
        }\r
        else\r