1. 06 Oct, 2016 11 commits
    • Arnd Bergmann's avatar
      net: caif: fix misleading indentation · 93a443b3
      Arnd Bergmann authored
      commit 8e0cc8c3 upstream.
      
      gcc points out code that is not indented the way it is
      interpreted:
      
      net/caif/cfpkt_skbuff.c: In function 'cfpkt_setlen':
      net/caif/cfpkt_skbuff.c:289:4: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
          return cfpkt_getlen(pkt);
          ^~~~~~
      net/caif/cfpkt_skbuff.c:286:3: note: ...this 'else' clause, but it is not
         else
         ^~~~
      
      It is clear from the context that not returning here would be
      a bug, as we'd end up passing a negative length into a function
      that takes a u16 length, so it is not missing curly braces
      here, and I'm assuming that the indentation is the only part
      that's wrong about it.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      93a443b3
    • Steven Rostedt's avatar
      Makefile: Mute warning for __builtin_return_address(>0) for tracing only · ea837f4b
      Steven Rostedt authored
      commit 377ccbb4 upstream.
      
      With the latest gcc compilers, they give a warning if
      __builtin_return_address() parameter is greater than 0. That is because if
      it is used by a function called by a top level function (or in the case of
      the kernel, by assembly), it can try to access stack frames outside the
      stack and crash the system.
      
      The tracing system uses __builtin_return_address() of up to 2! But it is
      well aware of the dangers that it may have, and has even added precautions
      to protect against it (see the thunk code in arch/x86/entry/thunk*.S)
      
      Linus originally added KBUILD_CFLAGS that would suppress the warning for the
      entire kernel, as simply adding KBUILD_CFLAGS to the tracing directory
      wouldn't work. The tracing directory plays a bit with the CFLAGS and
      requires a little more logic.
      
      This adds that special logic to only suppress the warning for the tracing
      directory. If it is used anywhere else outside of tracing, the warning will
      still be triggered.
      
      Link: http://lkml.kernel.org/r/20160728223043.51996267@grimm.local.homeTested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ea837f4b
    • Linus Torvalds's avatar
      Disable "frame-address" warning · 9bfa0853
      Linus Torvalds authored
      commit 124a3d88 upstream.
      
      Newer versions of gcc warn about the use of __builtin_return_address()
      with a non-zero argument when "-Wall" is specified:
      
        kernel/trace/trace_irqsoff.c: In function ‘stop_critical_timings’:
        kernel/trace/trace_irqsoff.c:433:86: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address]
           stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
        [ .. repeats a few times for other similar cases .. ]
      
      It is true that a non-zero argument is somewhat dangerous, and we do not
      actually have very many uses of that in the kernel - but the ftrace code
      does use it, and as Stephen Rostedt says:
      
       "We are well aware of the danger of using __builtin_return_address() of
        > 0.  In fact that's part of the reason for having the "thunk" code in
        x86 (See arch/x86/entry/thunk_{64,32}.S).  [..] it adds extra frames
        when tracking irqs off sections, to prevent __builtin_return_address()
        from accessing bad areas.  In fact the thunk_32.S states: 'Trampoline to
        trace irqs off.  (otherwise CALLER_ADDR1 might crash)'."
      
      For now, __builtin_return_address() with a non-zero argument is the best
      we can do, and the warning is not helpful and can end up making people
      miss other warnings for real problems.
      
      So disable the frame-address warning on compilers that need it.
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      9bfa0853
    • Linus Torvalds's avatar
      Disable "maybe-uninitialized" warning globally · b06dcea1
      Linus Torvalds authored
      commit 6e8d666e upstream.
      
      Several build configurations had already disabled this warning because
      it generates a lot of false positives.  But some had not, and it was
      still enabled for "allmodconfig" builds, for example.
      
      Looking at the warnings produced, every single one I looked at was a
      false positive, and the warnings are frequent enough (and big enough)
      that they can easily hide real problems that you don't notice in the
      noise generated by -Wmaybe-uninitialized.
      
      The warning is good in theory, but this is a classic case of a warning
      that causes more problems than the warning can solve.
      
      If gcc gets better at avoiding false positives, we may be able to
      re-enable this warning.  But as is, we're better off without it, and I
      want to be able to see the *real* warnings.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      b06dcea1
    • Arnd Bergmann's avatar
      gcov: disable -Wmaybe-uninitialized warning · 79a24f75
      Arnd Bergmann authored
      commit e72e2dfe upstream.
      
      When gcov profiling is enabled, we see a lot of spurious warnings about
      possibly uninitialized variables being used:
      
      arch/arm/mm/dma-mapping.c: In function 'arm_coherent_iommu_map_page':
      arch/arm/mm/dma-mapping.c:1085:16: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
      drivers/clk/st/clk-flexgen.c: In function 'st_of_flexgen_setup':
      drivers/clk/st/clk-flexgen.c:323:9: warning: 'num_parents' may be used uninitialized in this function [-Wmaybe-uninitialized]
      kernel/cgroup.c: In function 'cgroup_mount':
      kernel/cgroup.c:2119:11: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      All of these are false positives, so it seems better to just disable
      the warnings whenever GCOV is enabled. Most users don't enable GCOV,
      and based on a prior patch, it is now also disabled for 'allmodconfig'
      builds, so there should be no downsides of doing this.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarPeter Oberparleiter <oberpar@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      79a24f75
    • Arnd Bergmann's avatar
      Kbuild: disable 'maybe-uninitialized' warning for CONFIG_PROFILE_ALL_BRANCHES · 67804f8e
      Arnd Bergmann authored
      commit 815eb71e upstream.
      
      CONFIG_PROFILE_ALL_BRANCHES confuses gcc-5.x to the degree that it prints
      incorrect warnings about a lot of variables that it thinks can be used
      uninitialized, e.g.:
      
      i2c/busses/i2c-diolan-u2c.c: In function 'diolan_usb_xfer':
      i2c/busses/i2c-diolan-u2c.c:391:16: warning: 'byte' may be used uninitialized in this function
      iio/gyro/itg3200_core.c: In function 'itg3200_probe':
      iio/gyro/itg3200_core.c:213:6: warning: 'val' may be used uninitialized in this function
      leds/leds-lp55xx-common.c: In function 'lp55xx_update_bits':
      leds/leds-lp55xx-common.c:350:6: warning: 'tmp' may be used uninitialized in this function
      misc/bmp085.c: In function 'show_pressure':
      misc/bmp085.c:363:10: warning: 'pressure' may be used uninitialized in this function
      power/ds2782_battery.c: In function 'ds2786_get_capacity':
      power/ds2782_battery.c:214:17: warning: 'raw' may be used uninitialized in this function
      
      These are all false positives that either rob someone's time when trying
      to figure out whether they are real, or they get people to send wrong
      patches to shut up the warnings.
      
      Nobody normally wants to run a CONFIG_PROFILE_ALL_BRANCHES kernel in
      production, so disabling the whole class of warnings for this configuration
      has no serious downsides either.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: Steven Rostedt <rostedtgoodmis.org>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      67804f8e
    • Robert Jarzmik's avatar
      kbuild: forbid kernel directory to contain spaces and colons · 941646b9
      Robert Jarzmik authored
      commit 51193b76 upstream.
      
      When the kernel path contains a space or a colon somewhere in the path
      name, the modules_install target doesn't work anymore, as the path names
      are not enclosed in double quotes. It is also supposed that and O= build
      will suffer from the same weakness as modules_install.
      
      Instead of checking and improving kbuild to resist to directories
      including these characters, error out early to prevent any build if the
      kernel's main directory contains a space.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      941646b9
    • Wang YanQing's avatar
      Makefile: revert "Makefile: Document ability to make file.lst and file.S" partially · 55ee86c9
      Wang YanQing authored
      commit 40ab87a4 upstream.
      
      Commit 62718979 ("Makefile: Document ability to make file.lst
      and file.S") document ability to make file.S, but there isn't such
      ability in kbuild, so revert it.
      Signed-off-by: default avatarWang YanQing <udknight@gmail.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      55ee86c9
    • Michal Marek's avatar
      kbuild: Do not run modules_install and install in paralel · 7e87d5a7
      Michal Marek authored
      commit a85a41ed upstream.
      
      Based on a x86-only patch by Andy Lutomirski <luto@amacapital.net>
      
      With modular kernels, 'make install' is going to need the installed
      modules at some point to generate the initramfs.
      Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7e87d5a7
    • Ashish Samant's avatar
      ocfs2: fix start offset to ocfs2_zero_range_for_truncate() · 341ec0a3
      Ashish Samant authored
      commit d21c353d upstream.
      
      If we punch a hole on a reflink such that following conditions are met:
      
      1. start offset is on a cluster boundary
      2. end offset is not on a cluster boundary
      3. (end offset is somewhere in another extent) or
         (hole range > MAX_CONTIG_BYTES(1MB)),
      
      we dont COW the first cluster starting at the start offset.  But in this
      case, we were wrongly passing this cluster to
      ocfs2_zero_range_for_truncate() to zero out.  This will modify the
      cluster in place and zero it in the source too.
      
      Fix this by skipping this cluster in such a scenario.
      
      To reproduce:
      
      1. Create a random file of say 10 MB
           xfs_io -c 'pwrite -b 4k 0 10M' -f 10MBfile
      2. Reflink  it
           reflink -f 10MBfile reflnktest
      3. Punch a hole at starting at cluster boundary  with range greater that
      1MB. You can also use a range that will put the end offset in another
      extent.
           fallocate -p -o 0 -l 1048615 reflnktest
      4. sync
      5. Check the  first cluster in the source file. (It will be zeroed out).
          dd if=10MBfile iflag=direct bs=<cluster size> count=1 | hexdump -C
      
      Link: http://lkml.kernel.org/r/1470957147-14185-1-git-send-email-ashish.samant@oracle.comSigned-off-by: default avatarAshish Samant <ashish.samant@oracle.com>
      Reported-by: default avatarSaar Maoz <saar.maoz@oracle.com>
      Reviewed-by: default avatarSrinivas Eeda <srinivas.eeda@oracle.com>
      Cc: Mark Fasheh <mfasheh@versity.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Joseph Qi <joseph.qi@huawei.com>
      Cc: Eric Ren <zren@suse.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      341ec0a3
    • Joseph Qi's avatar
      ocfs2/dlm: fix race between convert and migration · 84f0c561
      Joseph Qi authored
      commit e6f0c6e6 upstream.
      
      Commit ac7cf246 ("ocfs2/dlm: fix race between convert and recovery")
      checks if lockres master has changed to identify whether new master has
      finished recovery or not.  This will introduce a race that right after
      old master does umount ( means master will change), a new convert
      request comes.
      
      In this case, it will reset lockres state to DLM_RECOVERING and then
      retry convert, and then fail with lockres->l_action being set to
      OCFS2_AST_INVALID, which will cause inconsistent lock level between
      ocfs2 and dlm, and then finally BUG.
      
      Since dlm recovery will clear lock->convert_pending in
      dlm_move_lockres_to_recovery_list, we can use it to correctly identify
      the race case between convert and recovery.  So fix it.
      
      Fixes: ac7cf246 ("ocfs2/dlm: fix race between convert and recovery")
      Link: http://lkml.kernel.org/r/57CE1569.8010704@huawei.comSigned-off-by: default avatarJoseph Qi <joseph.qi@huawei.com>
      Signed-off-by: default avatarJun Piao <piaojun@huawei.com>
      Cc: Mark Fasheh <mfasheh@versity.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      84f0c561
  2. 29 Sep, 2016 29 commits