提交 afd9970f 编写于 作者: M Michael Albaugh 提交者: Roland Dreier

IB/ipath: Allow old and new diagnostic packet formats

This patch checks for old and new format writes to send a packet via the
diagnostic interface.
Signed-off-by: NMichael Albaugh <Michael.Albaugh@Qlogic.com>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 7ce5eacb
......@@ -332,15 +332,20 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
u64 val;
u32 l_state, lt_state; /* LinkState, LinkTrainingState */
if (count != sizeof(dp)) {
if (count < sizeof(odp)) {
ret = -EINVAL;
goto bail;
}
if (count == sizeof(dp)) {
if (copy_from_user(&dp, data, sizeof(dp))) {
ret = -EFAULT;
goto bail;
}
} else if (copy_from_user(&odp, data, sizeof(odp))) {
ret = -EFAULT;
goto bail;
}
/*
* Due to padding/alignment issues (lessened with new struct)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册