Commit afd9970f authored by Michael Albaugh's avatar Michael Albaugh Committed by 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: default avatarMichael Albaugh <Michael.Albaugh@Qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 7ce5eacb
......@@ -332,12 +332,17 @@ 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 (copy_from_user(&dp, data, sizeof(dp))) {
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment