1. 27 Jul, 2017 4 commits
    • Johan Hovold's avatar
      thermal: max77620: fix device-node reference imbalance · b0bc1293
      Johan Hovold authored
      commit c592fafb upstream.
      
      The thermal child device reuses the parent MFD-device device-tree node
      when registering a thermal zone, but did not take a reference to the
      node.
      
      This leads to a reference imbalance, and potential use-after-free, when
      the node reference is dropped by the platform-bus device destructor
      (once for the child and later again for the parent).
      
      Fix this by dropping any reference already held to a device-tree node
      and getting a reference to the parent's node which will be balanced on
      reprobe or on platform-device release, whichever comes first.
      
      Note that simply clearing the of_node pointer on probe errors and on
      driver unbind would not allow the use of device-managed resources as
      specifically thermal_zone_of_sensor_unregister() claims that a valid
      device-tree node pointer is needed during deregistration (even if it
      currently does not seem to use it).
      
      Fixes: ec4664b3 ("thermal: max77620: Add thermal driver for reporting junction temp")
      Cc: Laxman Dewangan <ldewangan@nvidia.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0bc1293
    • Mauro Carvalho Chehab's avatar
      s5p-jpeg: don't return a random width/height · 7c684630
      Mauro Carvalho Chehab authored
      commit a16e3772 upstream.
      
      Gcc 7.1 complains about:
      
      drivers/media/platform/s5p-jpeg/jpeg-core.c: In function 's5p_jpeg_parse_hdr.isra.9':
      drivers/media/platform/s5p-jpeg/jpeg-core.c:1207:12: warning: 'width' may be used uninitialized in this function [-Wmaybe-uninitialized]
        result->w = width;
        ~~~~~~~~~~^~~~~~~
      drivers/media/platform/s5p-jpeg/jpeg-core.c:1208:12: warning: 'height' may be used uninitialized in this function [-Wmaybe-uninitialized]
        result->h = height;
        ~~~~~~~~~~^~~~~~~~
      
      Indeed the code would allow it to return a random value (although
      it shouldn't happen, in practice). So, explicitly set both to zero,
      just in case.
      Acked-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c684630
    • Arnd Bergmann's avatar
      ir-core: fix gcc-7 warning on bool arithmetic · 0f2de249
      Arnd Bergmann authored
      commit bd7e31bb upstream.
      
      gcc-7 suggests that an expression using a bitwise not and a bitmask
      on a 'bool' variable is better written using boolean logic:
      
      drivers/media/rc/imon.c: In function 'imon_incoming_scancode':
      drivers/media/rc/imon.c:1725:22: error: '~' on a boolean expression [-Werror=bool-operation]
          ictx->pad_mouse = ~(ictx->pad_mouse) & 0x1;
                            ^
      drivers/media/rc/imon.c:1725:22: note: did you mean to use logical not?
      
      I agree.
      
      Fixes: 21677cfc ("V4L/DVB: ir-core: add imon driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f2de249
    • Linus Torvalds's avatar
      disable new gcc-7.1.1 warnings for now · e346433d
      Linus Torvalds authored
      commit bd664f6b upstream.
      
      I made the mistake of upgrading my desktop to the new Fedora 26 that
      comes with gcc-7.1.1.
      
      There's nothing wrong per se that I've noticed, but I now have 1500
      lines of warnings, mostly from the new format-truncation warning
      triggering all over the tree.
      
      We use 'snprintf()' and friends in a lot of places, and often know that
      the numbers are fairly small (ie a controller index or similar), but gcc
      doesn't know that, and sees an 'int', and thinks that it could be some
      huge number.  And then complains when our buffers are not able to fit
      the name for the ten millionth controller.
      
      These warnings aren't necessarily bad per se, and we probably want to
      look through them subsystem by subsystem, but at least during the merge
      window they just mean that I can't even see if somebody is introducing
      any *real* problems when I pull.
      
      So warnings disabled for now.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e346433d
  2. 21 Jul, 2017 36 commits