Merge tag 'tpmdd-next-v5.12-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / sound / core / control.c
index 3b44378..5165741 100644 (file)
@@ -261,7 +261,7 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
        kctl->id.device = ncontrol->device;
        kctl->id.subdevice = ncontrol->subdevice;
        if (ncontrol->name) {
-               strlcpy(kctl->id.name, ncontrol->name, sizeof(kctl->id.name));
+               strscpy(kctl->id.name, ncontrol->name, sizeof(kctl->id.name));
                if (strcmp(ncontrol->name, kctl->id.name) != 0)
                        pr_warn("ALSA: Control name '%s' truncated to '%s'\n",
                                ncontrol->name, kctl->id.name);
@@ -701,12 +701,12 @@ static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl,
                return -ENOMEM;
        down_read(&snd_ioctl_rwsem);
        info->card = card->number;
-       strlcpy(info->id, card->id, sizeof(info->id));
-       strlcpy(info->driver, card->driver, sizeof(info->driver));
-       strlcpy(info->name, card->shortname, sizeof(info->name));
-       strlcpy(info->longname, card->longname, sizeof(info->longname));
-       strlcpy(info->mixername, card->mixername, sizeof(info->mixername));
-       strlcpy(info->components, card->components, sizeof(info->components));
+       strscpy(info->id, card->id, sizeof(info->id));
+       strscpy(info->driver, card->driver, sizeof(info->driver));
+       strscpy(info->name, card->shortname, sizeof(info->name));
+       strscpy(info->longname, card->longname, sizeof(info->longname));
+       strscpy(info->mixername, card->mixername, sizeof(info->mixername));
+       strscpy(info->components, card->components, sizeof(info->components));
        up_read(&snd_ioctl_rwsem);
        if (copy_to_user(arg, info, sizeof(struct snd_ctl_card_info))) {
                kfree(info);
@@ -836,7 +836,7 @@ static void fill_remaining_elem_value(struct snd_ctl_elem_value *control,
 {
        size_t offset = value_sizes[info->type] * info->count;
 
-       offset = (offset + sizeof(u32) - 1) / sizeof(u32);
+       offset = DIV_ROUND_UP(offset, sizeof(u32));
        memset32((u32 *)control->value.bytes.data + offset, pattern,
                 sizeof(control->value) / sizeof(u32) - offset);
 }
@@ -928,7 +928,7 @@ static int sanity_check_elem_value(struct snd_card *card,
 
        /* check whether the remaining area kept untouched */
        offset = value_sizes[info->type] * info->count;
-       offset = (offset + sizeof(u32) - 1) / sizeof(u32);
+       offset = DIV_ROUND_UP(offset, sizeof(u32));
        p = (u32 *)control->value.bytes.data + offset;
        for (; offset < sizeof(control->value) / sizeof(u32); offset++, p++) {
                if (*p != pattern) {
@@ -2137,7 +2137,7 @@ int snd_ctl_enum_info(struct snd_ctl_elem_info *info, unsigned int channels,
        WARN(strlen(names[info->value.enumerated.item]) >= sizeof(info->value.enumerated.name),
             "ALSA: too long item name '%s'\n",
             names[info->value.enumerated.item]);
-       strlcpy(info->value.enumerated.name,
+       strscpy(info->value.enumerated.name,
                names[info->value.enumerated.item],
                sizeof(info->value.enumerated.name));
        return 0;