Skip to content

Commit

Permalink
[IB] Fix RMPP receive length calculation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hal Rosenstock authored and Roland Dreier committed Sep 21, 2005
1 parent 972d512 commit f2065e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/core/mad_rmpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f2065e4

Please sign in to comment.