ALSA: rawmidi: fix incorrect array bounds check on clock_names
authorColin Ian King <colin.king@canonical.com>
Wed, 19 May 2021 10:54:24 +0000 (11:54 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 19 May 2021 14:20:25 +0000 (16:20 +0200)
commita6de7b32b686a6bda835c7c0f2de98eddbf48321
treecfc340a23a1df6e3996f8c4b8b8819c7331eb58e
parent3fda230b3ef8bba9a37f77288551ade5c1ee6533
ALSA: rawmidi: fix incorrect array bounds check on clock_names

The array bounds check on clock_names is currently checking the size
of the entire array rather than the number of elements in the array
leading to a potential array bounds read error. Fix this by using
the ARRAY_SIZE macro instead of sizeof.

Addresses-Coverity: ("Out-of-bounds read")
Fixes: 08fdced60ca0 ("ALSA: rawmidi: Add framing mode")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210519105424.55221-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/rawmidi.c