]> git.baikalelectronics.ru Git - kernel.git/commit
mm/fremap.c: fix possible oops on error path
authorMichel Lespinasse <walken@google.com>
Thu, 14 Mar 2013 23:50:02 +0000 (16:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Mar 2013 00:00:39 +0000 (17:00 -0700)
commit3f31b2771cae155b289cde12f38ffccfedff6ffd
treeb4b067886ae9a6f7cc8bff96ab2f7096b1f493aa
parentb784614ade1369a867d1ea134a14a48c4b4fbf6f
mm/fremap.c: fix possible oops on error path

The vm_flags introduced in 82c243ee30c5 ("mm/fremap.c: fix oops on error
path") is supposed to avoid a compiler warning about unitialized
vm_flags without changing the generated code.

However I am concerned that this is going to be very brittle, and fail
with some compiler versions. The failure could be either of:

- compiler could actually load vma->vm_flags before checking for the
  !vma condition, thus reintroducing the oops

- compiler could optimize out the !vma check, since the pointer just got
  dereferenced shortly before (so the compiler knows it can't be NULL!)

I propose reversing this part of the change and initializing vm_flags to 0
just to avoid the bogus uninitialized use warning.

Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/fremap.c