Skip to content
  1. Jan 11, 2019
  2. Jan 10, 2019
  3. Jan 09, 2019
    • Gustavo A. R. Silva's avatar
      qxl: Use struct_size() in kzalloc() · d4b9dd50
      Gustavo A. R. Silva authored
      
      
      One of the more common cases of allocation size calculations is finding the
      size of a structure that has a zero-sized array at the end, along with memory
      for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          void *entry[];
      };
      
      instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can now
      use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This code was detected with the help of Coccinelle.
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20190108162152.GA25361@embeddedor
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      d4b9dd50
    • Ezequiel Garcia's avatar
      drm/virtio: Drop deprecated load/unload initialization · d516e75c
      Ezequiel Garcia authored
      
      
      Move the code around so the driver is probed the bus
      .probe and removed from the bus .remove callbacks.
      This commit is just a cleanup and shouldn't affect
      functionality.
      
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20190108145930.15080-1-ezequiel@collabora.com
      Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      d516e75c
    • Peter Wu's avatar
      drm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup · 00eb5b0d
      Peter Wu authored
      After drm_fb_helper_fbdev_setup calls drm_fb_helper_init,
      "dev->fb_helper" will be initialized (and thus drm_fb_helper_fini will
      have some effect). After that, drm_fb_helper_initial_config is called
      which may call the "fb_probe" driver callback.
      
      This driver callback may call drm_fb_helper_defio_init (as is done by
      drm_fb_helper_generic_probe) or set a framebuffer (as is done by bochs)
      as documented. These are normally cleaned up on exit by
      drm_fb_helper_fbdev_teardown which also calls drm_fb_helper_fini.
      
      If an error occurs after "fb_probe", but before setup is complete, then
      calling just drm_fb_helper_fini will leak resources. This was triggered
      by df2052cc ("bochs: convert to drm_fb_helper_fbdev_setup/teardown"):
      
          [   50.008030] bochsdrmfb: enable CONFIG_FB_LITTLE_ENDIAN to support this framebuffer
          [   50.009436] bochs-drm 0000:00:02.0: [drm:drm_fb_helper_fbdev_setup] *ERROR* fbdev: Failed to set configuration (ret=-38)
          [   50.011456] [drm] Initialized bochs-drm 1.0.0 20130925 for 0000:00:02.0 on minor 2
          [   50.013604] WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x280/0x2a0
          [   50.016175] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G                T 4.20.0-rc7 #1
          [   50.017732] EIP: drm_mode_config_cleanup+0x280/0x2a0
          ...
          [   50.023155] Call Trace:
          [   50.023155]  ? bochs_kms_fini+0x1e/0x30
          [   50.023155]  ? bochs_unload+0x18/0x40
      
      This can be reproduced with QEMU and CONFIG_FB_LITTLE_ENDIAN=n.
      
      Link: https://lkml.kernel.org/r/20181221083226.GI23332@shao2-debian
      Link: https://lkml.kernel.org/r/20181223004315.GA11455@al
      Fixes: 87412163
      
       ("drm/fb-helper: Add drm_fb_helper_fbdev_setup/teardown()")
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Signed-off-by: default avatarPeter Wu <peter@lekensteyn.nl>
      Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181223005507.28328-1-peter@lekensteyn.nl
      00eb5b0d
    • Noralf Trønnes's avatar
      drm/fb-helper: generic: Fix setup error path · 6e1490cf
      Noralf Trønnes authored
      If register_framebuffer() fails during fbdev setup we will leak the
      framebuffer, the GEM buffer and the shadow buffer for defio. This is
      because drm_fb_helper_fbdev_setup() just calls drm_fb_helper_fini() on
      error not taking into account that register_framebuffer() can fail.
      
      Since the generic emulation uses DRM client for its framebuffer and
      backing buffer in addition to a shadow buffer, it's necessary to open code
      drm_fb_helper_fbdev_setup() to properly handle the error path.
      
      Error cleanup is removed from .fb_probe and is handled by one function for
      all paths.
      
      Fixes: 9060d7f4
      
       ("drm/fb-helper: Finish the generic fbdev emulation")
      Reported-by: default avatarPeter Wu <peter@lekensteyn.nl>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Acked-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190105181846.26495-1-noralf@tronnes.org
      6e1490cf
  4. Jan 08, 2019
  5. Jan 07, 2019
    • Maxime Ripard's avatar
      Merge tag 'topic/drmp-cleanup-2019-01-02' of... · 1c95f662
      Maxime Ripard authored
      
      Merge tag 'topic/drmp-cleanup-2019-01-02' of git://anongit.freedesktop.org/drm/drm-intel into drm-misc-next
      
      Make some drm headers self-contained with includes and forward declarations
      
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
      
      # gpg: Signature made Wed 02 Jan 2019 10:47:51 AM CET
      # gpg:                using RSA key 1565A65B77B0632E1124E59CD398079D26ABEE6F
      # gpg: Can't check signature: No public key
      From: Jani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/87pntfl6pa.fsf@intel.com
      1c95f662