]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IB] Fix RMPP receive length calculation
authorHal Rosenstock <halr@voltaire.com>
Wed, 21 Sep 2005 19:33:09 +0000 (12:33 -0700)
committerRoland Dreier <rolandd@cisco.com>
Wed, 21 Sep 2005 19:33:09 +0000 (12:33 -0700)
Based on simplification idea from Sean Hefty <sean.hefty@intel.com>

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/mad_rmpp.c

index 8f7cef0812f6a4836853dd72a6125ced6a559aba..e23836d0e21be53b6ff0df319c08b9c899af72ca 100644 (file)
@@ -412,8 +412,8 @@ static inline int get_mad_len(struct mad_rmpp_recv *rmpp_recv)
 
        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;