From: Takashi Iwai Date: Thu, 12 Mar 2015 06:38:46 +0000 (+0100) Subject: Merge branch 'for-linus' into for-next X-Git-Tag: v4.1-rc1~117^2~6^2~43^2~14 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=e6826ef14597981f78156a0d5f9553b19f356e3f;p=linux.git Merge branch 'for-linus' into for-next --- e6826ef14597981f78156a0d5f9553b19f356e3f diff --cc sound/core/control.c index 833b223a363a,eeb691d1911f..54a412af3224 --- a/sound/core/control.c +++ b/sound/core/control.c @@@ -1205,11 -1166,22 +1205,16 @@@ static int snd_ctl_elem_add(struct snd_ unsigned int access; long private_size; struct user_element *ue; - int idx, err; + int err; - if (info->count < 1) - return -EINVAL; + if (!*info->id.name) + return -EINVAL; + if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name)) + return -EINVAL; - access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : - (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE| - SNDRV_CTL_ELEM_ACCESS_INACTIVE| - SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)); - info->id.numid = 0; - memset(&kctl, 0, sizeof(kctl)); + + /* Delete a control to replace them if needed. */ if (replace) { + info->id.numid = 0; err = snd_ctl_remove_user_ctl(file, &info->id); if (err) return err;