Skip to content

Commit

Permalink
ALSA: info: Avoid leaking kernel memory
Browse files Browse the repository at this point in the history
Make sure that the allocated buffer for reading the proc file won't
expose the uncleared kernel memory.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Mar 13, 2013
1 parent eb7c06e commit 0d861ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/core/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static int resize_info_buffer(struct snd_info_buffer *buffer,
char *nbuf;

nsize = PAGE_ALIGN(nsize);
nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL);
nbuf = krealloc(buffer->buffer, nsize, GFP_KERNEL | __GFP_ZERO);
if (! nbuf)
return -ENOMEM;

Expand Down Expand Up @@ -353,7 +353,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
goto __nomem;
data->rbuffer = buffer;
buffer->len = PAGE_SIZE;
buffer->buffer = kmalloc(buffer->len, GFP_KERNEL);
buffer->buffer = kzalloc(buffer->len, GFP_KERNEL);
if (buffer->buffer == NULL)
goto __nomem;
}
Expand Down

0 comments on commit 0d861ac

Please sign in to comment.