ASoC: topology: Fix variable overflow in split_format
PATCH 1/1 ASoC: topology: Fix variable overflow in split_format
The 1 which was 32-bit long, when left-shifted by more than 31 caused an overflow, which resulted in some of the formats being not supported.
Signed-off-by Marcin Pietraszko <[email protected]>
--- src/topology/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/topology/pcm.c +1 -1
@@ -321,7 +321,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)return -EINVAL ; } - caps->formats |=1 << format; + caps->formats |=1ull << format; s =strtok (NULL ,", " ); i++; }
Signature · 1 line
2.7.4
CC Takashi and Mark.
Quoted 2 lines · Marcin Pietraszko
The 1 which was 32-bit long, when left-shifted by more than 31 caused an overflow, which resulted in some of the formats being not supported.
Looks like an alsa-lib patch?
Quoted 20 lines
Signed-off-by Marcin Pietraszko <[email protected]>--- src/topology/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/topology/pcm.c +1
-1@@ -321,7 +321,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)return -EINVAL ; } - caps->formats |=1 << format; + caps->formats |=1ull << format; s =strtok (NULL ,", " ); i++; }
Quoted 8 lines · Pierre-Louis Bossart
CC Takashi and Mark.Quoted 2 lines · Marcin Pietraszko
The 1 which was 32-bit long, when left-shifted by more than 31 caused an overflow, which resulted in some of the formats being not supported.
Looks like an alsa-lib patch?
Seems so. I applied to alsa-lib repo now.
thanks,
Takashi
Quoted 21 lines
Quoted 20 lines
Signed-off-by Marcin Pietraszko <[email protected]>--- src/topology/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/topology/pcm.c +1
-0@@ -321,7 +321,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)return -EINVAL ; } - caps->formats |=1 << format; + caps->formats |=1ull << format; s =strtok (NULL ,", " ); i++; }