All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rex.Zhu@amd.com
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/amd/powerplay: implement fw related smu interface for iceland.
Date: Tue, 11 Oct 2016 09:16:19 +0300	[thread overview]
Message-ID: <20161011061619.GA1724@mwanda> (raw)

Hello Rex Zhu,

The patch 18aafc59b106: "drm/amd/powerplay: implement fw related smu
interface for iceland." from Aug 23, 2016, leads to the following
static checker warning:

	drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smc.c:2462 iceland_set_mc_special_registers()
	error: buffer overflow 'table->mc_reg_address' 16 <= 16

drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smc.c
  2441                          j++;
  2442                          PP_ASSERT_WITH_CODE((j < SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE),
                                                     ^^^^^^^^^^
Note the < here.

  2443                                  "Invalid VramInfo table.", return -EINVAL);
  2444  
  2445                          temp_reg = cgs_read_register(hwmgr->device, mmMC_PMG_CMD_MRS);
  2446                          table->mc_reg_address[j].s1 = mmMC_PMG_CMD_MRS;
  2447                          table->mc_reg_address[j].s0 = mmMC_SEQ_PMG_CMD_MRS_LP;
  2448                          for (k = 0; k < table->num_entries; k++) {
  2449                                  table->mc_reg_table_entry[k].mc_data[j] =
  2450                                          (temp_reg & 0xffff0000) |
  2451                                          (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff);
  2452  
  2453                                  if (!data->is_memory_gddr5) {
  2454                                          table->mc_reg_table_entry[k].mc_data[j] |= 0x100;
  2455                                  }
  2456                          }
  2457                          j++;
  2458                          PP_ASSERT_WITH_CODE((j <= SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE),


This should be < as well.

  2459                                  "Invalid VramInfo table.", return -EINVAL);
  2460  
  2461                          if (!data->is_memory_gddr5) {
  2462                                  table->mc_reg_address[j].s1 = mmMC_PMG_AUTO_CMD;
  2463                                  table->mc_reg_address[j].s0 = mmMC_PMG_AUTO_CMD;
  2464                                  for (k = 0; k < table->num_entries; k++) {
  2465                                          table->mc_reg_table_entry[k].mc_data[j] =
  2466                                                  (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16;
  2467                                  }
  2468                                  j++;
  2469                                  PP_ASSERT_WITH_CODE((j <= SMU71_DISCRETE_MC_REGISTER_ARRAY_SIZE),

But I don't know about this one.

  2470                                          "Invalid VramInfo table.", return -EINVAL);
  2471                          }
  2472  
  2473                          break;
  2474  
  2475                  case mmMC_SEQ_RESERVE_M:


regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

                 reply	other threads:[~2016-10-11  6:16 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=20161011061619.GA1724@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Rex.Zhu@amd.com \
    --cc=dri-devel@lists.freedesktop.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.