From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:10578:9: warning: use of NULL 'data' where non-null expected [CWE-476]
Date: Mon, 04 Jul 2022 17:18:51 +0800 [thread overview]
Message-ID: <202207041717.tpv41kQH-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 17172 bytes --]
::::::
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:10578:9: warning: use of NULL 'data' where non-null expected [CWE-476] [-Wanalyzer-null-argument]"
::::::
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Stylon Wang <stylon.wang@amd.com>
CC: Alex Deucher <alexander.deucher@amd.com>
CC: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 88084a3df1672e131ddc1b4e39eeacfd39864acf
commit: 46db138dc83ae16e188038358c925c560110f804 drm/amd/display: Add Freesync HDMI support to DM with DMUB
date: 12 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 12 months ago
config: arm-randconfig-c002-20220703 (https://download.01.org/0day-ci/archive/20220704/202207041717.tpv41kQH-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=46db138dc83ae16e188038358c925c560110f804
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 46db138dc83ae16e188038358c925c560110f804
# save the config file
ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error'
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
gcc-analyzer warnings: (new ones prefixed by >>)
| | ~
| | |
| | (8) ...to here
| | (9) following 'false' branch (when 'old_plane_crtc' is non-NULL)...
|
'dm_update_plane_state': event 10
|
|include/drm/drm_atomic.h:542:21:
| 542 | return state->crtcs[drm_crtc_index(crtc)].old_state;
| | ~~~~~^~~~~~~
| | |
| | (10) ...to here
|
'dm_update_plane_state': event 11
|
|drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9953:20:
| 9953 | if (!dm_old_crtc_state->stream)
| | ^
| | |
| | (11) following 'false' branch...
|
'dm_update_plane_state': event 12
|
|include/drm/drm_print.h:516:9:
| 516 | __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (12) ...to here
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9956:17: note: in expansion of macro 'DRM_DEBUG_ATOMIC'
| 9956 | DRM_DEBUG_ATOMIC("Disabling DRM plane: %d on DRM crtc %d\n",
| | ^~~~~~~~~~~~~~~~
|
'dm_update_plane_state': event 13
|
| 9959 | ret = dm_atomic_get_state(state, &dm_state);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (13) calling 'dm_atomic_get_state' from 'dm_update_plane_state'
|
+--> 'dm_atomic_get_state': events 14-18
|
| 3287 | static int dm_atomic_get_state(struct drm_atomic_state *state,
| | ^~~~~~~~~~~~~~~~~~~
| | |
| | (14) entry to 'dm_atomic_get_state'
|......
| 3295 | if (*dm_state)
| | ~~~~~~~~~~
| | ||
| | |(15) 'dm_state' is NULL
| | (16) following 'false' branch...
|......
| 3298 | priv_state = drm_atomic_get_private_obj_state(state, &dm->atomic_obj);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (17) ...to here
| 3299 | if (IS_ERR(priv_state))
| | ~
| | |
| | (18) following 'true' branch...
|
'dm_atomic_get_state': event 19
|
|include/linux/err.h:31:16:
| 31 | return (long) ptr;
| | ^~~~~~~~~~
| | |
| | (19) ...to here
|
<------+
|
'dm_update_plane_state': events 20-24
|
|drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9959:23:
| 9959 | ret = dm_atomic_get_state(state, &dm_state);
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (20) returning to 'dm_update_plane_state' from 'dm_atomic_get_state'
| 9960 | if (ret)
| | ~
| | |
| | (21) following 'false' branch (when 'ret == 0')...
|......
| 9963 | if (!dc_remove_plane_from_context(
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (22) ...to here
| | (24) dereference of NULL 'dm_state'
| 9964 | dc,
| | ~~~
| 9965 | dm_old_crtc_state->stream,
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~
| 9966 | dm_old_plane_state->dc_state,
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 9967 | dm_state->context)) {
| | ~~~~~~~~~~~~~~~~~~
| | |
| | (23) 'dm_state' is NULL
|
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 'dm_edid_parser_send_cea':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:10578:9: warning: use of NULL 'data' where non-null expected [CWE-476] [-Wanalyzer-null-argument]
10578 | memcpy(input->payload, data, length);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'parse_hdmi_amd_vsdb': events 1-2
|
|10678 | static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector,
| | ^~~~~~~~~~~~~~~~~~~
| | |
| | (1) entry to 'parse_hdmi_amd_vsdb'
|......
|10687 | if (edid == NULL || edid->extensions == 0)
| | ~
| | |
| | (2) following 'false' branch...
|
'parse_hdmi_amd_vsdb': event 3
|
|cc1:
| (3): ...to here
|
'parse_hdmi_amd_vsdb': events 4-10
|
|10691 | for (i = 0; i < edid->extensions; i++) {
| | ~~^~~~~~~~~~~~~~~~~~
| | |
| | (4) following 'false' branch...
|......
|10697 | if (i == edid->extensions)
| | ~
| | |
| | (5) ...to here
| | (6) following 'false' branch...
|......
|10701 | if (edid_ext[0] != CEA_EXT)
| | ~~~~~~~~~~~~
| | | |
| | | (7) ...to here
| | (8) following 'false' branch...
|......
|10704 | valid_vsdb_found = parse_edid_cea(aconnector, edid_ext, EDID_LENGTH, vsdb_info);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (9) ...to here
| | (10) calling 'parse_edid_cea' from 'parse_hdmi_amd_vsdb'
|
+--> 'parse_edid_cea': events 11-14
|
|10666 | static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector,
| | ^~~~~~~~~~~~~~
| | |
| | (11) entry to 'parse_edid_cea'
|......
|10672 | if (adev->dm.dmub_srv)
| | ~
| | |
| | (12) following 'true' branch...
|10673 | return parse_edid_cea_dmub(&adev->dm, edid_ext, len, vsdb_info);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (13) ...to here
| | (14) calling 'parse_edid_cea_dmub' from 'parse_edid_cea'
|
+--> 'parse_edid_cea_dmub': events 15-20
|
|10650 | static bool parse_edid_cea_dmub(struct amdgpu_display_manager *dm,
| | ^~~~~~~~~~~~~~~~~~~
| | |
| | (15) entry to 'parse_edid_cea_dmub'
|......
|10657 | for (i = 0; i < len; i += 8) {
| | ~~~~~~~
| | |
| | (16) following 'true' branch (when 'i < len')...
|10658 | /* send 8 bytes a time */
|10659 | if (!dm_edid_parser_send_cea(dm, i, len, &edid_ext[i], 8, vsdb_info))
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (17) ...to here
| | (18) 'edid_ext' is NULL
| | (19) 'edid_ext' is NULL
| | (20) calling 'dm_edid_parser_send_cea' from 'parse_edid_cea_dmub'
|
+--> 'dm_edid_parser_send_cea': events 21-24
|
|10552 | static bool dm_edid_parser_send_cea(struct amdgpu_display_manager *dm,
| | ^~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (21) entry to 'dm_edid_parser_send_cea'
|......
|10564 | if (length > DMUB_EDID_CEA_DATA_CHUNK_BYTES)
| | ~
| | |
| | (22) following 'false' branch (when 'length <= 8')...
|......
|10571 | cmd.edid_cea.header.type = DMUB_CMD__EDID_CEA;
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (23) ...to here
|......
|10578 | memcpy(input->payload, data, length);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/data +10578 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
f9b4f20c4777bd Stylon Wang 2020-12-04 10551
46db138dc83ae1 Stylon Wang 2021-05-29 10552 static bool dm_edid_parser_send_cea(struct amdgpu_display_manager *dm,
46db138dc83ae1 Stylon Wang 2021-05-29 10553 unsigned int offset,
46db138dc83ae1 Stylon Wang 2021-05-29 10554 unsigned int total_length,
46db138dc83ae1 Stylon Wang 2021-05-29 10555 uint8_t *data,
46db138dc83ae1 Stylon Wang 2021-05-29 10556 unsigned int length,
46db138dc83ae1 Stylon Wang 2021-05-29 10557 struct amdgpu_hdmi_vsdb_info *vsdb)
46db138dc83ae1 Stylon Wang 2021-05-29 10558 {
46db138dc83ae1 Stylon Wang 2021-05-29 10559 bool res;
46db138dc83ae1 Stylon Wang 2021-05-29 10560 union dmub_rb_cmd cmd;
46db138dc83ae1 Stylon Wang 2021-05-29 10561 struct dmub_cmd_send_edid_cea *input;
46db138dc83ae1 Stylon Wang 2021-05-29 10562 struct dmub_cmd_edid_cea_output *output;
46db138dc83ae1 Stylon Wang 2021-05-29 10563
46db138dc83ae1 Stylon Wang 2021-05-29 10564 if (length > DMUB_EDID_CEA_DATA_CHUNK_BYTES)
46db138dc83ae1 Stylon Wang 2021-05-29 10565 return false;
46db138dc83ae1 Stylon Wang 2021-05-29 10566
46db138dc83ae1 Stylon Wang 2021-05-29 10567 memset(&cmd, 0, sizeof(cmd));
46db138dc83ae1 Stylon Wang 2021-05-29 10568
46db138dc83ae1 Stylon Wang 2021-05-29 10569 input = &cmd.edid_cea.data.input;
46db138dc83ae1 Stylon Wang 2021-05-29 10570
46db138dc83ae1 Stylon Wang 2021-05-29 10571 cmd.edid_cea.header.type = DMUB_CMD__EDID_CEA;
46db138dc83ae1 Stylon Wang 2021-05-29 10572 cmd.edid_cea.header.sub_type = 0;
46db138dc83ae1 Stylon Wang 2021-05-29 10573 cmd.edid_cea.header.payload_bytes =
46db138dc83ae1 Stylon Wang 2021-05-29 10574 sizeof(cmd.edid_cea) - sizeof(cmd.edid_cea.header);
46db138dc83ae1 Stylon Wang 2021-05-29 10575 input->offset = offset;
46db138dc83ae1 Stylon Wang 2021-05-29 10576 input->length = length;
46db138dc83ae1 Stylon Wang 2021-05-29 10577 input->total_length = total_length;
46db138dc83ae1 Stylon Wang 2021-05-29 @10578 memcpy(input->payload, data, length);
46db138dc83ae1 Stylon Wang 2021-05-29 10579
46db138dc83ae1 Stylon Wang 2021-05-29 10580 res = dc_dmub_srv_cmd_with_reply_data(dm->dc->ctx->dmub_srv, &cmd);
46db138dc83ae1 Stylon Wang 2021-05-29 10581 if (!res) {
46db138dc83ae1 Stylon Wang 2021-05-29 10582 DRM_ERROR("EDID CEA parser failed\n");
46db138dc83ae1 Stylon Wang 2021-05-29 10583 return false;
46db138dc83ae1 Stylon Wang 2021-05-29 10584 }
46db138dc83ae1 Stylon Wang 2021-05-29 10585
46db138dc83ae1 Stylon Wang 2021-05-29 10586 output = &cmd.edid_cea.data.output;
46db138dc83ae1 Stylon Wang 2021-05-29 10587
46db138dc83ae1 Stylon Wang 2021-05-29 10588 if (output->type == DMUB_CMD__EDID_CEA_ACK) {
46db138dc83ae1 Stylon Wang 2021-05-29 10589 if (!output->ack.success) {
46db138dc83ae1 Stylon Wang 2021-05-29 10590 DRM_ERROR("EDID CEA ack failed at offset %d\n",
46db138dc83ae1 Stylon Wang 2021-05-29 10591 output->ack.offset);
46db138dc83ae1 Stylon Wang 2021-05-29 10592 }
46db138dc83ae1 Stylon Wang 2021-05-29 10593 } else if (output->type == DMUB_CMD__EDID_CEA_AMD_VSDB) {
46db138dc83ae1 Stylon Wang 2021-05-29 10594 if (!output->amd_vsdb.vsdb_found)
46db138dc83ae1 Stylon Wang 2021-05-29 10595 return false;
46db138dc83ae1 Stylon Wang 2021-05-29 10596
46db138dc83ae1 Stylon Wang 2021-05-29 10597 vsdb->freesync_supported = output->amd_vsdb.freesync_supported;
46db138dc83ae1 Stylon Wang 2021-05-29 10598 vsdb->amd_vsdb_version = output->amd_vsdb.amd_vsdb_version;
46db138dc83ae1 Stylon Wang 2021-05-29 10599 vsdb->min_refresh_rate_hz = output->amd_vsdb.min_frame_rate;
46db138dc83ae1 Stylon Wang 2021-05-29 10600 vsdb->max_refresh_rate_hz = output->amd_vsdb.max_frame_rate;
46db138dc83ae1 Stylon Wang 2021-05-29 10601 } else {
46db138dc83ae1 Stylon Wang 2021-05-29 10602 DRM_ERROR("Unknown EDID CEA parser results\n");
46db138dc83ae1 Stylon Wang 2021-05-29 10603 return false;
46db138dc83ae1 Stylon Wang 2021-05-29 10604 }
46db138dc83ae1 Stylon Wang 2021-05-29 10605
46db138dc83ae1 Stylon Wang 2021-05-29 10606 return true;
46db138dc83ae1 Stylon Wang 2021-05-29 10607 }
46db138dc83ae1 Stylon Wang 2021-05-29 10608
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next reply other threads:[~2022-07-04 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 9:18 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-03 18:02 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:10578:9: warning: use of NULL 'data' where non-null expected [CWE-476] 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=202207041717.tpv41kQH-lkp@intel.com \
--to=lkp@intel.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.