[openib-general] [PATCHv2] mad_rmpp: Fix receive length calculation

Hal Rosenstock halr at voltaire.com
Tue Sep 20 16:00:50 PDT 2005


mad_rmpp: Fix receive length calculation

Based on simplification idea from Sean Hefty <sean.hefty at intel.com>

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: mad_rmpp.c
===================================================================
--- mad_rmpp.c  (revision 3496)
+++ mad_rmpp.c  (working copy)
@@ -412,8 +412,8 @@ static inline int get_mad_len(struct mad
 
        hdr_size = data_offset(rmpp_mad->mad_hdr.mgmt_class);
        data_size = sizeof(struct ib_rmpp_mad) - hdr_size;
-       pad = data_size - be32_to_cpu(rmpp_mad->rmpp_hdr.paylen_newwin);
-       if (pad > data_size || pad < 0)
+       pad = IB_MGMT_RMPP_DATA - be32_to_cpu(rmpp_mad->rmpp_hdr.paylen_newwin);
+       if (pad > IB_MGMT_RMPP_DATA || pad < 0)
                pad = 0;
 
        return hdr_size + rmpp_recv->seg_num * data_size - pad;





More information about the general mailing list