Skip to contentSkip to conversation

Staging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

PATCH Superseded Sandhya Bankar 2 participants 2 messages Mar 5, 2016 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

---
 drivers/staging/comedi/comedi_fops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +1 -1
index d1cf6a1..7c7b477 100644
@@ -2224,7 +2224,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
 		retval = -EFAULT;
 		goto done;
 	}
-	if (size & (~PAGE_MASK)) {
+	if (offset_in_page(size)) {
 		retval = -EFAULT;
 		goto done;
 	}
Signature · 1 line
1.8.3.4
#1 lore raw
Quoted 12 lines · Sandhya Bankar

Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

---
 drivers/staging/comedi/comedi_fops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/comedi_fops.c +0 -0
index d1cf6a1..7c7b477 100644

drivers/staging/comedi/comedi_fops.c static int comedi_mmap(struct file *file, struct vm_area_struct *vma) · line 2227

Quoted 5 lines
drivers/staging/comedi/comedi_fops.c +1 -1
@@ -2224,7 +2224,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
 		retval = -EFAULT;
 		goto done;
 	}
-	if (size & (~PAGE_MASK)) {
+	if (offset_in_page(size)) {

Much nicer :)

julia

Quoted 13 lines
drivers/staging/comedi/comedi_fops.c +0 -1
 		retval = -EFAULT;
 		goto done;
 	}
--

1.8.3.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160305000721.GA3072%40sandhya.
For more options, visit https://groups.google.com/d/optout.