Skip to content

CI check error: use of uninitialized value ‘string’  #5291

@bardliao

Description

@bardliao
sound/soc/sof/debug-dsp-ops.c:216:19: error: use of uninitialized value ‘string’ [CWE-457] [-Werror=analyzer-use-of-uninitialized-value]
  216 |         if (*ppos || !string)
      |             ~~~~~~^~~~~~~~~~
  ‘sof_dsp_ops_tester_dfs_read’: events 1-11
    |
    |  181 |         const char *string;
    |      |                     ^~~~~~
    |      |                     |
    |      |                     (1) region created on stack here
    |      |                     (2) capacity: 8 bytes
    |......
    |  186 |         if (!strcmp(dentry->d_name.name, "fw_filename")) {
    |      |            ~         
    |      |            |
    |      |            (3) following ‘false’ branch (when the strings are non-equal)...
    |  187 |                 string = sdev->test_profile.fw_name;
    |  188 |         } else if (!strcmp(dentry->d_name.name, "fw_path")) {
    |      |                   ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                   | |
    |      |                   | (4) ...to here
    |      |                   (5) following ‘false’ branch (when the strings are non-equal)...
    |  189 |                 string = sdev->test_profile.fw_path;
    |  190 |         } else if (!strcmp(dentry->d_name.name, "dsp_power_state")) {
    |      |                   ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                   | |
    |      |                   | (6) ...to here
    |      |                   (7) following ‘true’ branch (when the strings are equal)...
    |  191 |                 switch (sdev->dsp_power_state.state) {
    |      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                                              |
    |      |                                              (8) ...to here
    |......
    |  216 |         if (*ppos || !string)
    |      |            ~~~~~~~~~~~~~~~~~
    |      |            |      |
    |      |            |      (10) ...to here
    |      |            |      (11) use of uninitialized value ‘string’ here
    |      |            (9) following ‘false’ branch...
    |

Potential fix: #5289

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions