Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: sb: check get_user() return value

get_user() may fail, if so return -EFAULT.

[Fixed one missing place by tiwai]

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Kulikov Vasiliy and committed by
Takashi Iwai
5157cc81 63818c44

+6 -3
+6 -3
sound/isa/sb/emu8000_pcm.c
··· 433 433 while (count > 0) { 434 434 unsigned short sval; 435 435 CHECK_SCHEDULER(); 436 - get_user(sval, buf); 436 + if (get_user(sval, buf)) 437 + return -EFAULT; 437 438 EMU8000_SMLD_WRITE(emu, sval); 438 439 buf++; 439 440 count--; ··· 526 525 while (count-- > 0) { 527 526 unsigned short sval; 528 527 CHECK_SCHEDULER(); 529 - get_user(sval, buf); 528 + if (get_user(sval, buf)) 529 + return -EFAULT; 530 530 EMU8000_SMLD_WRITE(emu, sval); 531 531 buf++; 532 532 if (rec->voices > 1) { 533 533 CHECK_SCHEDULER(); 534 - get_user(sval, buf); 534 + if (get_user(sval, buf)) 535 + return -EFAULT; 535 536 EMU8000_SMRD_WRITE(emu, sval); 536 537 buf++; 537 538 }