Skip to content

Commit 45779b0

Browse files
Tom Rixtorvalds
authored andcommitted
mm: initialize return of vm_insert_pages
clang static analysis reports a garbage return In file included from mm/memory.c:84: mm/memory.c:1612:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn] return err; ^~~~~~~~~~ The setting of err depends on a loop executing. So initialize err. Signed-off-by: Tom Rix <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3bef735 commit 45779b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr,
16011601
return insert_pages(vma, addr, pages, num, vma->vm_page_prot);
16021602
#else
16031603
unsigned long idx = 0, pgcount = *num;
1604-
int err;
1604+
int err = -EINVAL;
16051605

16061606
for (; idx < pgcount; ++idx) {
16071607
err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]);

0 commit comments

Comments
 (0)