ALSA: rme9652: Hardening for potential Spectre v1
authorTakashi Iwai <tiwai@suse.de>
Tue, 24 Apr 2018 06:04:41 +0000 (08:04 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 25 Apr 2018 08:37:48 +0000 (10:37 +0200)
commitf526afcd8f71945c23ce581d7864ace93de8a4f7
tree910de0bc4f2596055400f6c7e501ad28b3dd664f
parent10513142a7114d251670361ad40cba2c61403406
ALSA: rme9652: Hardening for potential Spectre v1

As recently Smatch suggested, one place in RME9652 driver may expand
the array directly from the user-space value with speculation:
  sound/pci/rme9652/rme9652.c:2074 snd_rme9652_channel_info() warn: potential spectre issue 'rme9652->channel_map' (local cap)

This patch puts array_index_nospec() for hardening against it.

BugLink: https://marc.info/?l=linux-kernel&m=152411496503418&w=2
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/rme9652/rme9652.c