Skip to contentSkip to conversation

HSI: cmt_speech: use vma_pages().

PATCH In review Muhammad Falak R Wani 2 participants 2 messages May 21, 2016 – May 30, 2016 HSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HSI: cmt_speech: use vma_pages().

Replace explicit computation of vma page count by a call to vma_pages()

---
 drivers/hsi/clients/cmt_speech.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hsi/clients/cmt_speech.c +1 -1
index 95638df..b16cfa4 100644
@@ -1275,7 +1275,7 @@ static int cs_char_mmap(struct file *file, struct vm_area_struct *vma)
 	if (vma->vm_end < vma->vm_start)
 		return -EINVAL;
 
-	if (((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) != 1)
+	if (vma_pages(vma) != 1)
 		return -EINVAL;
 
 	vma->vm_flags |= VM_IO | VM_DONTDUMP | VM_DONTEXPAND;
Signature · 1 line
1.9.1
#1 lore raw

Hi,

Quoted 13 lines · Muhammad Falak R Wani

Replace explicit computation of vma page count by a call to vma_pages()

---
 drivers/hsi/clients/cmt_speech.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hsi/clients/cmt_speech.c +0 -0
index 95638df..b16cfa4 100644

drivers/hsi/clients/cmt_speech.c static int cs_char_mmap(struct file *file, struct vm_area_struct *vma) · line 1281

Quoted 8 lines
drivers/hsi/clients/cmt_speech.c +1 -1
@@ -1275,7 +1275,7 @@ static int cs_char_mmap(struct file *file, struct vm_area_struct *vma)
 	if (vma->vm_end < vma->vm_start)
 		return -EINVAL;
 
-	if (((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) != 1)
+	if (vma_pages(vma) != 1)
 		return -EINVAL;
 
 	vma->vm_flags |= VM_IO | VM_DONTDUMP | VM_DONTEXPAND;

Thanks, queued for 4.8.

-- Sebastian