Skip to content

Commit

Permalink
ALSA: sb: check get_user() return value
Browse files Browse the repository at this point in the history
get_user() may fail, if so return -EFAULT.

[Fixed one missing place by tiwai]

Signed-off-by: Kulikov Vasiliy <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
segoon authored and tiwai committed Jul 29, 2010
1 parent 63818c4 commit 5157cc8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sound/isa/sb/emu8000_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ static int emu8k_transfer_block(struct snd_emu8000 *emu, int offset, unsigned sh
while (count > 0) {
unsigned short sval;
CHECK_SCHEDULER();
get_user(sval, buf);
if (get_user(sval, buf))
return -EFAULT;
EMU8000_SMLD_WRITE(emu, sval);
buf++;
count--;
Expand Down Expand Up @@ -525,12 +526,14 @@ static int emu8k_pcm_copy(struct snd_pcm_substream *subs,
while (count-- > 0) {
unsigned short sval;
CHECK_SCHEDULER();
get_user(sval, buf);
if (get_user(sval, buf))
return -EFAULT;
EMU8000_SMLD_WRITE(emu, sval);
buf++;
if (rec->voices > 1) {
CHECK_SCHEDULER();
get_user(sval, buf);
if (get_user(sval, buf))
return -EFAULT;
EMU8000_SMRD_WRITE(emu, sval);
buf++;
}
Expand Down

0 comments on commit 5157cc8

Please sign in to comment.