tree: https://github.com/anholt/linux drm-v3d-cs head: cd44bb93f261828d519c4b27ecea156599e3f678 commit: 58e06f6b0cf8168b14ee8abc61712bbc038c99c8 [24/28] drm/v3d: Add support for compute shader dispatch.
New smatch warnings: drivers/gpu/drm/v3d/v3d_gem.c:740 v3d_submit_csd_ioctl() warn: double check that we're allocating correct size: 136 vs 204 Old smatch warnings: drivers/gpu/drm/v3d/v3d_gem.c:667 v3d_submit_tfu_ioctl() error: potential null dereference 'job->base.bo'. (kcalloc returns null) # https://github.com/anholt/linux/commit/58e06f6b0cf8168b14ee8abc61712bbc038c99c8 git remote add anholt https://github.com/anholt/linux git remote update anholt git checkout 58e06f6b0cf8168b14ee8abc61712bbc038c99c8 vim +740 drivers/gpu/drm/v3d/v3d_gem.c 58e06f6b Eric Anholt 2018-12-27 700 58e06f6b Eric Anholt 2018-12-27 701 /** 58e06f6b Eric Anholt 2018-12-27 702 * v3d_submit_csd_ioctl() - Submits a CSD (texture formatting) job to the V3D. 58e06f6b Eric Anholt 2018-12-27 703 * @dev: DRM device 58e06f6b Eric Anholt 2018-12-27 704 * @data: ioctl argument 58e06f6b Eric Anholt 2018-12-27 705 * @file_priv: DRM file for this fd 58e06f6b Eric Anholt 2018-12-27 706 * 58e06f6b Eric Anholt 2018-12-27 707 * Userspace provides the register setup for the CSD, which we don't 58e06f6b Eric Anholt 2018-12-27 708 * need to validate since the CSD is behind the MMU. 58e06f6b Eric Anholt 2018-12-27 709 */ 58e06f6b Eric Anholt 2018-12-27 710 int 58e06f6b Eric Anholt 2018-12-27 711 v3d_submit_csd_ioctl(struct drm_device *dev, void *data, 58e06f6b Eric Anholt 2018-12-27 712 struct drm_file *file_priv) 58e06f6b Eric Anholt 2018-12-27 713 { 58e06f6b Eric Anholt 2018-12-27 714 struct v3d_dev *v3d = to_v3d_dev(dev); 58e06f6b Eric Anholt 2018-12-27 715 struct v3d_file_priv *v3d_priv = file_priv->driver_priv; 58e06f6b Eric Anholt 2018-12-27 716 struct drm_v3d_submit_csd *args = data; 58e06f6b Eric Anholt 2018-12-27 717 struct v3d_csd_job *job; 58e06f6b Eric Anholt 2018-12-27 718 struct v3d_job *clean_job; 58e06f6b Eric Anholt 2018-12-27 719 struct ww_acquire_ctx acquire_ctx; 58e06f6b Eric Anholt 2018-12-27 720 int ret; 58e06f6b Eric Anholt 2018-12-27 721 58e06f6b Eric Anholt 2018-12-27 722 trace_v3d_submit_csd_ioctl(&v3d->drm, args->cfg[5], args->cfg[6]); 58e06f6b Eric Anholt 2018-12-27 723 58e06f6b Eric Anholt 2018-12-27 724 if (!v3d_has_csd(v3d)) { 58e06f6b Eric Anholt 2018-12-27 725 DRM_DEBUG("Attempting CSD submit on non-CSD hardware\n"); 58e06f6b Eric Anholt 2018-12-27 726 return -EINVAL; 58e06f6b Eric Anholt 2018-12-27 727 } 58e06f6b Eric Anholt 2018-12-27 728 58e06f6b Eric Anholt 2018-12-27 729 job = kcalloc(1, sizeof(*job), GFP_KERNEL); 58e06f6b Eric Anholt 2018-12-27 730 if (!job) 58e06f6b Eric Anholt 2018-12-27 731 return -ENOMEM; 58e06f6b Eric Anholt 2018-12-27 732 58e06f6b Eric Anholt 2018-12-27 733 ret = v3d_job_init(v3d, file_priv, &job->base, 58e06f6b Eric Anholt 2018-12-27 734 v3d_job_free, args->in_sync); 58e06f6b Eric Anholt 2018-12-27 735 if (ret) { 58e06f6b Eric Anholt 2018-12-27 736 kfree(job); 58e06f6b Eric Anholt 2018-12-27 737 return ret; 58e06f6b Eric Anholt 2018-12-27 738 } 58e06f6b Eric Anholt 2018-12-27 739 58e06f6b Eric Anholt 2018-12-27 @740 clean_job = kcalloc(1, sizeof(*job), GFP_KERNEL); ^^^^^^^^^^^^ sizeof(*job) is larger than sizeof(*clean_job) so this doesn't cause a problem except for the little bit extra memory allocated. 58e06f6b Eric Anholt 2018-12-27 741 if (!clean_job) { 58e06f6b Eric Anholt 2018-12-27 742 v3d_job_put(&job->base); 58e06f6b Eric Anholt 2018-12-27 743 kfree(job); 58e06f6b Eric Anholt 2018-12-27 744 return -ENOMEM; 58e06f6b Eric Anholt 2018-12-27 745 } 58e06f6b Eric Anholt 2018-12-27 746 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation _______________________________________________ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild