aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2016-06-27 15:06:51 -0400
committerTakashi Iwai <tiwai@suse.de>2016-06-27 16:27:47 -0400
commit9c6795a9b3cbb56a9fbfaf43909c5c22999ba317 (patch)
tree73f2ed280bd43618cb48595ad763f7069fd28ed4
parent81e43960dce1c8e58e682fb3ec26c1d8f83a9afc (diff)
ALSA: echoaudio: Fix memory allocation
'commpage_bak' is allocated with 'sizeof(struct echoaudio)' bytes. We then copy 'sizeof(struct comm_page)' bytes in it. On my system, smatch complains because one is 2960 and the other is 3072. This would result in memory corruption or a oops. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/echoaudio/echoaudio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 1cb85aeb0cea..286f5e3686a3 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -2200,11 +2200,11 @@ static int snd_echo_resume(struct device *dev)
2200 u32 pipe_alloc_mask; 2200 u32 pipe_alloc_mask;
2201 int err; 2201 int err;
2202 2202
2203 commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); 2203 commpage_bak = kmalloc(sizeof(*commpage), GFP_KERNEL);
2204 if (commpage_bak == NULL) 2204 if (commpage_bak == NULL)
2205 return -ENOMEM; 2205 return -ENOMEM;
2206 commpage = chip->comm_page; 2206 commpage = chip->comm_page;
2207 memcpy(commpage_bak, commpage, sizeof(struct comm_page)); 2207 memcpy(commpage_bak, commpage, sizeof(*commpage));
2208 2208
2209 err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device); 2209 err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);
2210 if (err < 0) { 2210 if (err < 0) {