diff options
author | Tom Rix <trix@redhat.com> | 2020-07-23 21:15:18 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-07-24 12:42:41 -0700 |
commit | 45779b036d3d2870633443a9f9bd03c177befbf5 (patch) | |
tree | abef90c1a93704fe1dada6dc17f47adee09abc69 /mm/memory.c | |
parent | 3bef735ad7b7d987069181e7b58588043cbd1509 (diff) | |
download | linux-45779b036d3d2870633443a9f9bd03c177befbf5.tar.gz linux-45779b036d3d2870633443a9f9bd03c177befbf5.tar.bz2 linux-45779b036d3d2870633443a9f9bd03c177befbf5.zip |
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 <trix@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20200703155354.29132-1-trix@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c index 87ec87cdc1ff..3ecad55103ad 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1601,7 +1601,7 @@ int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr, return insert_pages(vma, addr, pages, num, vma->vm_page_prot); #else unsigned long idx = 0, pgcount = *num; - int err; + int err = -EINVAL; for (; idx < pgcount; ++idx) { err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]); |