提交 f2065e42 编写于 作者: H Hal Rosenstock 提交者: Roland Dreier

[IB] Fix RMPP receive length calculation

Based on simplification idea from Sean Hefty <sean.hefty@intel.com>
Signed-off-by: NHal Rosenstock <halr@voltaire.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 972d512a
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册