Commit afd9970f authored by Michael Albaugh's avatar Michael Albaugh Committed by Roland Dreier
Browse files

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
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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)