Skip to contentSkip to conversation

IB/hfi1: Use kernel default llseek for ui device

PATCH In review Dennis Dalessandro 2 participants 3 messages Apr 22, 2016 – Apr 29, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/hfi1: Use kernel default llseek for ui device

From: Dean Luick <[email protected]>

The ui device llseek had a mistake with SEEK_END and did not fully follow seek semantics. Correct all this by using a kernel supplied function for fixed size devices.

---
 drivers/staging/rdma/hfi1/file_ops.c |   25 ++-----------------------
 1 files changed, 2 insertions(+), 23 deletions(-)
drivers/staging/rdma/hfi1/file_ops.c +2 -23
index ec6c226..5415295 100644
@@ -1559,29 +1559,8 @@ static loff_t ui_lseek(struct file *filp, loff_t offset, int whence)
 {
 	struct hfi1_devdata *dd = filp->private_data;
 
-	switch (whence) {
-	case SEEK_SET:
-		break;
-	case SEEK_CUR:
-		offset += filp->f_pos;
-		break;
-	case SEEK_END:
-		offset = ((dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE) -
-			offset;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	if (offset < 0)
-		return -EINVAL;
-
-	if (offset >= (dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE)
-		return -EINVAL;
-
-	filp->f_pos = offset;
-
-	return filp->f_pos;
+	return fixed_size_llseek(filp, offset, whence,
+		(dd->kregend - dd->kregbase) + DC8051_DATA_MEM_SIZE);
 }
 
 /* NOTE: assumes unsigned long is 8 bytes */

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive
Quoted 5 lines · Dennis Dalessandro

From: Dean Luick <[email protected]>

The ui device llseek had a mistake with SEEK_END and did not fully follow seek semantics. Correct all this by using a kernel supplied function for fixed size devices.

Doug, I think this should probably go in the rc, it fixes a 0-day bug.

-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · Dennis Dalessandro
Quoted 5 lines · Dennis Dalessandro

From: Dean Luick <[email protected]>

The ui device llseek had a mistake with SEEK_END and did not fully follow seek semantics. Correct all this by using a kernel supplied function for fixed size devices.

Doug, I think this should probably go in the rc, it fixes a 0-day bug.

-Denny

It's in my next pull request.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD