From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Alex Deucher <alexander.deucher@amd.com>,
Chris Park <Chris.Park@amd.com>
Subject: [linux-next:master 2996/11714] drivers/gpu/drm/amd/amdgpu/../display/dc/dcn303/dcn303_resource.c:531 dcn303_stream_encoder_create() warn: possible memory leak of 'enc1'
Date: Tue, 22 Jun 2021 12:33:44 +0300 [thread overview]
Message-ID: <202106221722.yp3fNeWU-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 889bab4c367a0ef58208fd80fafa74bb6e2dca26
commit: cd6d421e3d1ad5926b74091254e345db730e7706 [2996/11714] drm/amd/display: Initial DC support for Beige Goby
config: i386-randconfig-m021-20210622 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 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>
smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn303/dcn303_resource.c:531 dcn303_stream_encoder_create() warn: possible memory leak of 'enc1'
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn303/dcn303_resource.c:533 dcn303_stream_encoder_create() error: buffer overflow 'stream_enc_regs' 2 <= 4
vim +/enc1 +531 drivers/gpu/drm/amd/amdgpu/../display/dc/dcn303/dcn303_resource.c
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 511 static struct stream_encoder *dcn303_stream_encoder_create(enum engine_id eng_id, struct dc_context *ctx)
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 512 {
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 513 struct dcn10_stream_encoder *enc1;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 514 struct vpg *vpg;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 515 struct afmt *afmt;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 516 int vpg_inst;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 517 int afmt_inst;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 518
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 519 /* Mapping of VPG, AFMT, DME register blocks to DIO block instance */
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 520 if (eng_id <= ENGINE_ID_DIGE) {
"eng_id" can be 4 here.
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 521 vpg_inst = eng_id;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 522 afmt_inst = eng_id;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 523 } else
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 524 return NULL;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 525
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 526 enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL);
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 527 vpg = dcn303_vpg_create(ctx, vpg_inst);
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 528 afmt = dcn303_afmt_create(ctx, afmt_inst);
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 529
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 530 if (!enc1 || !vpg || !afmt)
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 @531 return NULL;
Leaks.
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 532
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 @533 dcn30_dio_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id, vpg, afmt, &stream_enc_regs[eng_id],
stream_enc_regs[] is a two element array.
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 534 &se_shift, &se_mask);
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 535
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 536 return &enc1->base;
cd6d421e3d1ad5 Aurabindo Pillai 2021-03-15 537 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
reply other threads:[~2021-06-22 9:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202106221722.yp3fNeWU-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=Chris.Park@amd.com \
--cc=alexander.deucher@amd.com \
--cc=aurabindo.pillai@amd.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox