Skip to content

Commit b96c312

Browse files
tobluxrostedt
authored andcommitted
ring-buffer: Use vma_pages() helper function
Use the vma_pages() helper function and fix the following Coccinelle/coccicheck warning reported by vma_pages.cocci: WARNING: Consider using vma_pages helper on vma Rename the local variable vma_pages accordingly. Signed-off-by: Thorsten Blum <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 94dfa50 commit b96c312

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/trace/ring_buffer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6920,7 +6920,7 @@ static int __rb_inc_dec_mapped(struct ring_buffer_per_cpu *cpu_buffer,
69206920
static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer,
69216921
struct vm_area_struct *vma)
69226922
{
6923-
unsigned long nr_subbufs, nr_pages, vma_pages, pgoff = vma->vm_pgoff;
6923+
unsigned long nr_subbufs, nr_pages, nr_vma_pages, pgoff = vma->vm_pgoff;
69246924
unsigned int subbuf_pages, subbuf_order;
69256925
struct page **pages;
69266926
int p = 0, s = 0;
@@ -6946,11 +6946,11 @@ static int __rb_map_vma(struct ring_buffer_per_cpu *cpu_buffer,
69466946
nr_subbufs = cpu_buffer->nr_pages + 1; /* + reader-subbuf */
69476947
nr_pages = ((nr_subbufs) << subbuf_order) - pgoff + 1; /* + meta-page */
69486948

6949-
vma_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
6950-
if (!vma_pages || vma_pages > nr_pages)
6949+
nr_vma_pages = vma_pages(vma);
6950+
if (!nr_vma_pages || nr_vma_pages > nr_pages)
69516951
return -EINVAL;
69526952

6953-
nr_pages = vma_pages;
6953+
nr_pages = nr_vma_pages;
69546954

69556955
pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
69566956
if (!pages)

0 commit comments

Comments
 (0)