1. 19 3月, 2020 28 次提交
  2. 18 3月, 2020 2 次提交
  3. 17 3月, 2020 7 次提交
  4. 16 3月, 2020 3 次提交
    • C
      drm: Mark up racy check of drm_gem_object.handle_count · 6afe6929
      Chris Wilson 提交于
      [ 1715.899800] BUG: KCSAN: data-race in drm_gem_handle_create_tail / drm_gem_object_handle_put_unlocked
      [ 1715.899838]
      [ 1715.899861] write to 0xffff8881830f3604 of 4 bytes by task 7834 on cpu 1:
      [ 1715.899896]  drm_gem_handle_create_tail+0x62/0x250
      [ 1715.899927]  drm_gem_open_ioctl+0xc1/0x160
      [ 1715.899956]  drm_ioctl_kernel+0xe4/0x120
      [ 1715.899981]  drm_ioctl+0x297/0x4c7
      [ 1715.900003]  ksys_ioctl+0x89/0xb0
      [ 1715.900027]  __x64_sys_ioctl+0x42/0x60
      [ 1715.900052]  do_syscall_64+0x6e/0x2c0
      [ 1715.900079]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [ 1715.900100]
      [ 1715.900119] read to 0xffff8881830f3604 of 4 bytes by task 8137 on cpu 0:
      [ 1715.900149]  drm_gem_object_handle_put_unlocked+0x31/0x130
      [ 1715.900180]  drm_gem_object_release_handle+0x93/0xe0
      [ 1715.900208]  drm_gem_handle_delete+0x7b/0xe0
      [ 1715.900235]  drm_gem_close_ioctl+0x61/0x80
      [ 1715.900264]  drm_ioctl_kernel+0xe4/0x120
      [ 1715.900291]  drm_ioctl+0x297/0x4c7
      [ 1715.900316]  ksys_ioctl+0x89/0xb0
      [ 1715.900340]  __x64_sys_ioctl+0x42/0x60
      [ 1715.900363]  do_syscall_64+0x6e/0x2c0
      [ 1715.900388]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200309120151.7675-1-chris@chris-wilson.co.uk
      6afe6929
    • K
      drm/edid: Distribute switch variables for initialization · deec222e
      Kees Cook 提交于
      Variables declared in a switch statement before any case statements
      cannot be automatically initialized with compiler instrumentation (as
      they are not part of any execution flow). With GCC's proposed automatic
      stack variable initialization feature, this triggers a warning (and they
      don't get initialized). Clang's automatic stack variable initialization
      (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
      doesn't initialize such variables[1]. Note that these warnings (or silent
      skipping) happen before the dead-store elimination optimization phase,
      so even when the automatic initializations are later elided in favor of
      direct initializations, the warnings remain.
      
      To avoid these problems, lift such variables up into the next code
      block.
      
      drivers/gpu/drm/drm_edid.c: In function ‘drm_edid_to_eld’:
      drivers/gpu/drm/drm_edid.c:4395:9: warning: statement will never be
      executed [-Wswitch-unreachable]
       4395 |     int sad_count;
            |         ^~~~~~~~~
      
      [1] https://bugs.llvm.org/show_bug.cgi?id=44916
      
      v2: move into function block instead being switch-local (Ville Syrjälä)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      [danvet: keep the changelog]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/202003060930.DDCCB6659@keescook
      deec222e
    • G
      drm/vmwgfx: Replace zero-length array with flexible-array member · 6b656755
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      6b656755