Skip to content

Commit

Permalink
IB/ipath: Allow old and new diagnostic packet formats
Browse files Browse the repository at this point in the history
This patch checks for old and new format writes to send a packet via the
diagnostic interface.

Signed-off-by: Michael Albaugh <Michael.Albaugh@Qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Michael Albaugh authored and Roland Dreier committed Apr 17, 2008
1 parent 7ce5eac commit afd9970
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/infiniband/hw/ipath/ipath_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit afd9970

Please sign in to comment.