drm/msm: Remove dead code in msm_ioctl_gem_submit()
RFC PATCH 1/1 drm/msm: Remove dead code in msm_ioctl_gem_submit()
According to the report of Coverity Scan [1], "sync_file" is going to be NULL when entering the "if" section after "out_post_unlock", so "fput(sync_file->file)" is never going to be exected in this block.
[1]: https://scan5.scan.coverity.com/#/project-view/10074/10063?selectedIssue=1655089
--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/msm/msm_gem_submit.c +0 -2
@@ -904,8 +904,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, out_post_unlock:if (ret && (out_fence_fd >=0 )) {put_unused_fd (out_fence_fd); -if (sync_file) -fput (sync_file->file); }if (!IS_ERR_OR_NULL (submit)) {
Signature · 1 line
2.43.0
Quoted 15 lines · I Hsin Cheng
According to the report of Coverity Scan [1], "
sync_file" is going to be NULL when entering the "if" section after "out_post_unlock", so "fput(sync_file->file)" is never going to be exected in this block.[1]: https://scan5.scan.coverity.com/#/project-view/10074/10063?selectedIssue=1655089
Signed-off-by I Hsin Cheng <[email protected]>--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/msm/msm_gem_submit.c +0
-0
drivers/gpu/drm/msm/msm_gem_submit.c int msm_ioctl_gem_submit(struct drm_device *dev, void *data, · line 908
Quoted 5 lines
drivers/gpu/drm/msm/msm_gem_submit.c +0
-2@@ -904,8 +904,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, out_post_unlock:if (ret && (out_fence_fd >=0 )) {put_unused_fd (out_fence_fd); -if (sync_file) -fput (sync_file->file);
Are you sure you want delete these two lines? It might not make sense to check sync_file inside if (ret && (out_fence_fd >= 0)), but it is ncecessary to fput.
drivers/gpu/drm/msm/msm_gem_submit.c int msm_ioctl_gem_submit(struct drm_device *dev, void *data, · line 909
Quoted 3 lines
drivers/gpu/drm/msm/msm_gem_submit.c +0
-0}if (!IS_ERR_OR_NULL (submit)) {
Check the error paths carefully to see if this is indeed the right fix.
thanks,
-- Shuah
Quoted 12 lines · Shuah Khan
Quoted 10 lines · I Hsin Cheng
According to the report of Coverity Scan [1], "
sync_file" is going to be NULL when entering the "if" section after "out_post_unlock", so "fput(sync_file->file)" is never going to be exected in this block.[1]: https://scan5.scan.coverity.com/#/project-view/10074/10063?selectedIssue=1655089
Signed-off-by I Hsin Cheng <[email protected]>--- drivers/gpu/drm/msm/msm_gem_submit.c | 2 -- 1 file changed, 2 deletions(-)
Quoted 14 lines
drivers/gpu/drm/msm/msm_gem_submit.c int msm_ioctl_gem_submit(struct drm_device *dev, void *data, · line 908
Quoted 10 lines
drivers/gpu/drm/msm/msm_gem_submit.c +0
-2@@ -904,8 +904,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, out_post_unlock:if (ret && (out_fence_fd >=0 )) {put_unused_fd (out_fence_fd); -if (sync_file) -fput (sync_file->file);Are you sure you want delete these two lines? It might not make sense to check
sync_fileinside if (ret && (out_fence_fd>= 0)), but it is ncecessary to fput.
fwiw, there is at least about to be a code path where this error handling is not dead, once the VM_BIND series is merged
BR,
-R
Quoted 8 lines
drivers/gpu/drm/msm/msm_gem_submit.c int msm_ioctl_gem_submit(struct drm_device *dev, void *data, · line 909
Quoted 3 lines
drivers/gpu/drm/msm/msm_gem_submit.c +0
-0}if (!IS_ERR_OR_NULL (submit)) {Check the error paths carefully to see if this is indeed the right fix.
thanks,
-- Shuah