sound: control: fix minimum TLV length
authorClemens Ladisch <clemens@ladisch.de>
Mon, 1 Feb 2010 12:30:56 +0000 (13:30 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 1 Feb 2010 13:12:12 +0000 (14:12 +0100)
Allow TLV blocks that do not have any values; the smallest possible TLV
is an empty container or one where the information is only in the tag.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
sound/core/control.c

index 6a4764d..439ce64 100644 (file)
@@ -1100,7 +1100,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
 
        if (copy_from_user(&tlv, _tlv, sizeof(tlv)))
                return -EFAULT;
-       if (tlv.length < sizeof(unsigned int) * 3)
+       if (tlv.length < sizeof(unsigned int) * 2)
                return -EINVAL;
        down_read(&card->controls_rwsem);
        kctl = snd_ctl_find_numid(card, tlv.numid);