All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [agd5f:drm-next 50/60] drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:999 amdgpu_info_ioctl() warn: possible memory leak of 'caps'
Date: Fri, 29 Jan 2021 10:34:56 +0300	[thread overview]
Message-ID: <20210129073456.GL2696@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2948 bytes --]

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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34032 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [agd5f:drm-next 50/60] drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:999 amdgpu_info_ioctl() warn: possible memory leak of 'caps'
Date: Fri, 29 Jan 2021 10:34:56 +0300	[thread overview]
Message-ID: <20210129073456.GL2696@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2948 bytes --]

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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34032 bytes --]

             reply	other threads:[~2021-01-29  7:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29  7:34 Dan Carpenter [this message]
2021-01-29  7:34 ` [agd5f:drm-next 50/60] drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:999 amdgpu_info_ioctl() warn: possible memory leak of 'caps' Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-01-29  2:52 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210129073456.GL2696@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.