Commit 0d861ac2 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: info: Avoid leaking kernel memory

Make sure that the allocated buffer for reading the proc file won't
expose the uncleared kernel memory.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent eb7c06e8
...@@ -89,7 +89,7 @@ static int resize_info_buffer(struct snd_info_buffer *buffer, ...@@ -89,7 +89,7 @@ static int resize_info_buffer(struct snd_info_buffer *buffer,
char *nbuf; char *nbuf;
nsize = PAGE_ALIGN(nsize); nsize = PAGE_ALIGN(nsize);
nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL); nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL | __GFP_ZERO);
if (! nbuf) if (! nbuf)
return -ENOMEM; return -ENOMEM;
...@@ -353,7 +353,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) ...@@ -353,7 +353,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
goto __nomem; goto __nomem;
data->rbuffer = buffer; data->rbuffer = buffer;
buffer->len = PAGE_SIZE; buffer->len = PAGE_SIZE;
buffer->buffer = kmalloc(buffer->len, GFP_KERNEL); buffer->buffer = kzalloc(buffer->len, GFP_KERNEL);
if (buffer->buffer == NULL) if (buffer->buffer == NULL)
goto __nomem; goto __nomem;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment