]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: data: Fix wrong size check in tplg_parse_data_hex()
authorTakashi Iwai <tiwai@suse.de>
Tue, 8 Sep 2015 20:11:48 +0000 (22:11 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 8 Sep 2015 20:11:48 +0000 (22:11 +0200)
A wrong, uninitialized variable is referred as the size to check in
tplg_parse_data_hex().  Spotted by gcc warning:
  data.c: In function ‘tplg_parse_data_hex’:
  data.c:228:5: warning: ‘esize’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (esize > TPLG_MAX_PRIV_SIZE) {
        ^
  data.c:211:12: note: ‘esize’ was declared here
    int size, esize, off, num;
              ^

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/topology/data.c

index 4ee1f8a15f95498be0153ec966e9ecdb45aa0302..370c0faead368aea9a1fed4bd662c49dc86195da 100644 (file)
@@ -225,8 +225,8 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem,
        size = num * width;
        priv = elem->data;
 
-       if (esize > TPLG_MAX_PRIV_SIZE) {
-               SNDERR("error: data too big %d\n", esize);
+       if (size > TPLG_MAX_PRIV_SIZE) {
+               SNDERR("error: data too big %d\n", size);
                return -EINVAL;
        }