• Benny Halevy's avatar
    mm: fix uninitialized variables for find_vma_prepare callers · dfe195fb
    Benny Halevy authored
    gcc 4.3.0 correctly emits the following warnings.
    When a vma covering addr is found, find_vma_prepare indeed returns without
    setting pprev, rb_link, and rb_parent.
    
      mm/mmap.c: In function `insert_vm_struct':
      mm/mmap.c:2085: warning: `rb_parent' may be used uninitialized in this function
      mm/mmap.c:2085: warning: `rb_link' may be used uninitialized in this function
      mm/mmap.c:2084: warning: `prev' may be used uninitialized in this function
      mm/mmap.c: In function `copy_vma':
      mm/mmap.c:2124: warning: `rb_parent' may be used uninitialized in this function
      mm/mmap.c:2124: warning: `rb_link' may be used uninitialized in this function
      mm/mmap.c:2123: warning: `prev' may be used uninitialized in this function
      mm/mmap.c: In function `do_brk':
      mm/mmap.c:1951: warning: `rb_parent' may be used uninitialized in this function
      mm/mmap.c:1951: warning: `rb_link' may be used uninitialized in this function
      mm/mmap.c:1949: warning: `prev' may be used uninitialized in this function
      mm/mmap.c: In function `mmap_region':
      mm/mmap.c:1092: warning: `rb_parent' may be used uninitialized in this function
      mm/mmap.c:1092: warning: `rb_link' may be used uninitialized in this function
      mm/mmap.c:1089: warning: `prev' may be used uninitialized in this function
    
    Hugh adds: in fact, none of find_vma_prepare's callers use those values
    when a vma is found to be already covering addr, it's either an error or
    an occasion to munmap and repeat.  Okay, let's quieten the compiler (but I
    would prefer it if pprev, rb_link and rb_parent were meaningful in that
    case, rather than whatever's in them from descending the tree).
    Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Cc: "Ryan Hope" <rmh3093@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    dfe195fb
mmap.c 63.4 KB