drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:999 amdgpu_info_ioctl() warn: possible memory leak of 'caps'
PATCH 50/60 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:999 amdgpu_info_ioctl() warn: possible memory leak of 'caps'
tree: https://gitlab.freedesktop.org/agd5f/linux.git drm-next head: 92d7537f76bdb5485d663b49d79297769a0e0aa9 commit: 555fc7fbb2a2b2a13c8d59946ede06c8fe6b85bd [50/60] drm/amdgpu: add INFO ioctl support for querying video caps config: x86_64-randconfig-m001-20210128 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
New smatch warnings:drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:999 amdgpu_info_ioctl() warn: possible memory leak of 'caps'
Old smatch warnings:drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1004 amdgpu_info_ioctl() warn: possible memory leak of 'caps' drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1010 amdgpu_info_ioctl() warn: possible memory leak of 'caps'
vim +/caps +999 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
555fc7fbb2a2b2 Alex Deucher 2021-01-07 986 case AMDGPU_INFO_VIDEO_CAPS: {
555fc7fbb2a2b2 Alex Deucher 2021-01-07 987 const struct amdgpu_video_codecs *codecs;
555fc7fbb2a2b2 Alex Deucher 2021-01-07 988 struct drm_amdgpu_info_video_caps *caps;
555fc7fbb2a2b2 Alex Deucher 2021-01-07 989 int r;
555fc7fbb2a2b2 Alex Deucher 2021-01-07 990
555fc7fbb2a2b2 Alex Deucher 2021-01-07 991 caps = kzalloc(sizeof(*caps), GFP_KERNEL);
555fc7fbb2a2b2 Alex Deucher 2021-01-07 992 if (!caps)
555fc7fbb2a2b2 Alex Deucher 2021-01-07 993 return -ENOMEM;
555fc7fbb2a2b2 Alex Deucher 2021-01-07 994
555fc7fbb2a2b2 Alex Deucher 2021-01-07 995 switch (info->video_cap.type) {
555fc7fbb2a2b2 Alex Deucher 2021-01-07 996 case AMDGPU_INFO_VIDEO_CAPS_DECODE:
555fc7fbb2a2b2 Alex Deucher 2021-01-07 997 r = amdgpu_asic_query_video_codecs(adev, false, &codecs);
555fc7fbb2a2b2 Alex Deucher 2021-01-07 998 if (r)
555fc7fbb2a2b2 Alex Deucher 2021-01-07 @999 return -EINVAL;leaks "caps".
555fc7fbb2a2b2 Alex Deucher 2021-01-07 1000 break; 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1001 case AMDGPU_INFO_VIDEO_CAPS_ENCODE: 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1002 r = amdgpu_asic_query_video_codecs(adev, true, &codecs); 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1003 if (r) 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1004 return -EINVAL; 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1005 break; 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1006 break; 555fc7fbb2a2b2 Alex Deucher 2021-01-07 1007 default:
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org