fs: namespace: suppress 'may be used uninitialized' warnings 45/155645/1
authorTim Gardner <tim.gardner@canonical.com>
Thu, 28 Aug 2014 17:26:03 +0000 (11:26 -0600)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 16 Oct 2017 01:33:40 +0000 (10:33 +0900)
commit437b9d06e832892ab99ab29cf06a70ad49221f07
treef6d45f4008833fa2d7a6b81aca0fce83cf4b4678
parente7ce90e0937d6503a2c101f13961ca9aed270759
fs: namespace: suppress 'may be used uninitialized' warnings

commit b8850d1fa8e2f6653e57daf6d08e58c5f5eb2c85 upstream.

The gcc version 4.9.1 compiler complains Even though it isn't possible for
these variables to not get initialized before they are used.

fs/namespace.c: In function ‘SyS_mount’:
fs/namespace.c:2720:8: warning: ‘kernel_dev’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = do_mount(kernel_dev, kernel_dir->name, kernel_type, flags,
        ^
fs/namespace.c:2699:8: note: ‘kernel_dev’ was declared here
  char *kernel_dev;
        ^
fs/namespace.c:2720:8: warning: ‘kernel_type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  ret = do_mount(kernel_dev, kernel_dir->name, kernel_type, flags,
        ^
fs/namespace.c:2697:8: note: ‘kernel_type’ was declared here
  char *kernel_type;
        ^

Fix the warnings by simplifying copy_mount_string() as suggested by Al Viro.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[sw0312.kim: Backport from mainline to fix build warning]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: Id8e784ebc6e4300aebd883d9766fd66cb8ab76c1
fs/compat.c
fs/internal.h
fs/namespace.c