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: Michael Albaugh <Michael.Albaugh@Qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
committed by
Roland Dreier
parent
7ce5eacb45
commit
afd9970f95
@@ -332,15 +332,20 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
|
|||||||
u64 val;
|
u64 val;
|
||||||
u32 l_state, lt_state; /* LinkState, LinkTrainingState */
|
u32 l_state, lt_state; /* LinkState, LinkTrainingState */
|
||||||
|
|
||||||
if (count != sizeof(dp)) {
|
if (count < sizeof(odp)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count == sizeof(dp)) {
|
||||||
if (copy_from_user(&dp, data, sizeof(dp))) {
|
if (copy_from_user(&dp, data, sizeof(dp))) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
} else if (copy_from_user(&odp, data, sizeof(odp))) {
|
||||||
|
ret = -EFAULT;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Due to padding/alignment issues (lessened with new struct)
|
* Due to padding/alignment issues (lessened with new struct)
|
||||||
|
Reference in New Issue
Block a user