Skip to content

Commit 9a64425

Browse files
tiwaigregkh
authored andcommitted
ALSA: au88x0: Fix zero clear of stream->resources
commit 639db596165746ca87bbcb56559b094fd9042890 upstream. There are a few calls of memset() to stream->resources, but they all are called in a wrong size, sizeof(unsigned char) * VORTEX_RESOURCE_LAST, while this field is a u32 array. This may leave the memories not zero-cleared. Fix it by replacing them with a simpler sizeof(stream->resources) instead. Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent da8477a commit 9a64425

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

sound/pci/au88x0/au88x0_core.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,8 +2150,7 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
21502150
stream->resources, en,
21512151
VORTEX_RESOURCE_SRC)) < 0) {
21522152
memset(stream->resources, 0,
2153-
sizeof(unsigned char) *
2154-
VORTEX_RESOURCE_LAST);
2153+
sizeof(stream->resources));
21552154
return -EBUSY;
21562155
}
21572156
if (stream->type != VORTEX_PCM_A3D) {
@@ -2161,7 +2160,7 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
21612160
VORTEX_RESOURCE_MIXIN)) < 0) {
21622161
memset(stream->resources,
21632162
0,
2164-
sizeof(unsigned char) * VORTEX_RESOURCE_LAST);
2163+
sizeof(stream->resources));
21652164
return -EBUSY;
21662165
}
21672166
}
@@ -2174,8 +2173,7 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
21742173
stream->resources, en,
21752174
VORTEX_RESOURCE_A3D)) < 0) {
21762175
memset(stream->resources, 0,
2177-
sizeof(unsigned char) *
2178-
VORTEX_RESOURCE_LAST);
2176+
sizeof(stream->resources));
21792177
dev_err(vortex->card->dev,
21802178
"out of A3D sources. Sorry\n");
21812179
return -EBUSY;
@@ -2289,17 +2287,15 @@ vortex_adb_allocroute(vortex_t *vortex, int dma, int nr_ch, int dir,
22892287
VORTEX_RESOURCE_MIXOUT))
22902288
< 0) {
22912289
memset(stream->resources, 0,
2292-
sizeof(unsigned char) *
2293-
VORTEX_RESOURCE_LAST);
2290+
sizeof(stream->resources));
22942291
return -EBUSY;
22952292
}
22962293
if ((src[i] =
22972294
vortex_adb_checkinout(vortex,
22982295
stream->resources, en,
22992296
VORTEX_RESOURCE_SRC)) < 0) {
23002297
memset(stream->resources, 0,
2301-
sizeof(unsigned char) *
2302-
VORTEX_RESOURCE_LAST);
2298+
sizeof(stream->resources));
23032299
return -EBUSY;
23042300
}
23052301
}

0 commit comments

Comments
 (0)