diff options
| author | Dan Carpenter <error27@gmail.com> | 2010-08-27 16:02:15 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-08-28 05:59:33 -0400 |
| commit | 7a28826ac73d31a379d93785d8fbd24ab492b0bd (patch) | |
| tree | 3b3af569f7451b45941f9089494eb30487b7cb6f | |
| parent | 3182c8a72b31414e043184a97b0d5d3c0d590168 (diff) | |
ALSA: pcm: add more format names
There were some new formats added in commit 15c0cee6c809 "ALSA: pcm:
Define G723 3-bit and 5-bit formats". That commit increased
SNDRV_PCM_FORMAT_LAST as well. My concern is that there are a couple
places which do:
for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) {
if (dummy->pcm_hw.formats & (1ULL << i))
snd_iprintf(buffer, " %s", snd_pcm_format_name(i));
}
I haven't tested these but it looks like if "i" were equal to
SNDRV_PCM_FORMAT_G723_24 or higher then we might read past the end of
the array.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/core/pcm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index cbe815dfbdc8..204af48c5cc1 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
| @@ -203,10 +203,16 @@ static char *snd_pcm_format_names[] = { | |||
| 203 | FORMAT(S18_3BE), | 203 | FORMAT(S18_3BE), |
| 204 | FORMAT(U18_3LE), | 204 | FORMAT(U18_3LE), |
| 205 | FORMAT(U18_3BE), | 205 | FORMAT(U18_3BE), |
| 206 | FORMAT(G723_24), | ||
| 207 | FORMAT(G723_24_1B), | ||
| 208 | FORMAT(G723_40), | ||
| 209 | FORMAT(G723_40_1B), | ||
| 206 | }; | 210 | }; |
| 207 | 211 | ||
| 208 | const char *snd_pcm_format_name(snd_pcm_format_t format) | 212 | const char *snd_pcm_format_name(snd_pcm_format_t format) |
| 209 | { | 213 | { |
| 214 | if (format >= ARRAY_SIZE(snd_pcm_format_names)) | ||
| 215 | return "Unknown"; | ||
| 210 | return snd_pcm_format_names[format]; | 216 | return snd_pcm_format_names[format]; |
| 211 | } | 217 | } |
| 212 | EXPORT_SYMBOL_GPL(snd_pcm_format_name); | 218 | EXPORT_SYMBOL_GPL(snd_pcm_format_name); |
