From: Geoffrey D. Bennett Date: Fri, 4 Oct 2024 14:28:39 +0000 (+0930) Subject: ALSA: scarlett2: Return ENOSPC for out-of-bounds flash writes X-Git-Tag: v6.13-rc1~123^2~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74641bfcbf4e698b770b1b62a74e73934843e90e;p=thirdparty%2Flinux.git ALSA: scarlett2: Return ENOSPC for out-of-bounds flash writes When writing to flash, return ENOSPC instead of EINVAL if the requested write would exceed the size of the flash segment. Signed-off-by: Geoffrey D. Bennett Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/3a4af07b0329bed5ffb6994594e4f7bd202aad0f.1727971672.git.g@b4.vu --- diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c index aa7c3d74ce8f1..844e95cc965ea 100644 --- a/sound/usb/mixer_scarlett2.c +++ b/sound/usb/mixer_scarlett2.c @@ -9516,7 +9516,7 @@ static long scarlett2_hwdep_write(struct snd_hwdep *hw, SCARLETT2_FLASH_BLOCK_SIZE; if (count < 0 || *offset < 0 || *offset + count >= flash_size) - return -EINVAL; + return -ENOSPC; if (!count) return 0;