diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-07-25 11:01:14 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-07-25 11:01:14 -0400 |
commit | cf81d6b583444cb6f5e656f050e43413b236354e (patch) | |
tree | 646567ef019e0bbc5cc9db0e26c464a9fc239481 /sound/core | |
parent | 76df52969711ae3725a98f26fbbc6a349803dcbf (diff) | |
parent | 275353bb684ecfeb42f7a353fead81d43a01c519 (diff) |
Merge branch 'for-next' into for-linus
Merged 4.8 changes.
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/control.c | 32 | ||||
-rw-r--r-- | sound/core/seq/oss/seq_oss_synth.c | 10 | ||||
-rw-r--r-- | sound/core/seq/seq_timer.c | 23 | ||||
-rw-r--r-- | sound/core/seq/seq_timer.h | 2 |
4 files changed, 47 insertions, 20 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index b4fe9b002512..fb096cb20a80 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -807,6 +807,36 @@ static int snd_ctl_elem_list(struct snd_card *card, | |||
807 | return 0; | 807 | return 0; |
808 | } | 808 | } |
809 | 809 | ||
810 | static bool validate_element_member_dimension(struct snd_ctl_elem_info *info) | ||
811 | { | ||
812 | unsigned int members; | ||
813 | unsigned int i; | ||
814 | |||
815 | if (info->dimen.d[0] == 0) | ||
816 | return true; | ||
817 | |||
818 | members = 1; | ||
819 | for (i = 0; i < ARRAY_SIZE(info->dimen.d); ++i) { | ||
820 | if (info->dimen.d[i] == 0) | ||
821 | break; | ||
822 | members *= info->dimen.d[i]; | ||
823 | |||
824 | /* | ||
825 | * info->count should be validated in advance, to guarantee | ||
826 | * calculation soundness. | ||
827 | */ | ||
828 | if (members > info->count) | ||
829 | return false; | ||
830 | } | ||
831 | |||
832 | for (++i; i < ARRAY_SIZE(info->dimen.d); ++i) { | ||
833 | if (info->dimen.d[i] > 0) | ||
834 | return false; | ||
835 | } | ||
836 | |||
837 | return members == info->count; | ||
838 | } | ||
839 | |||
810 | static int snd_ctl_elem_info(struct snd_ctl_file *ctl, | 840 | static int snd_ctl_elem_info(struct snd_ctl_file *ctl, |
811 | struct snd_ctl_elem_info *info) | 841 | struct snd_ctl_elem_info *info) |
812 | { | 842 | { |
@@ -1274,6 +1304,8 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, | |||
1274 | if (info->count < 1 || | 1304 | if (info->count < 1 || |
1275 | info->count > max_value_counts[info->type]) | 1305 | info->count > max_value_counts[info->type]) |
1276 | return -EINVAL; | 1306 | return -EINVAL; |
1307 | if (!validate_element_member_dimension(info)) | ||
1308 | return -EINVAL; | ||
1277 | private_size = value_sizes[info->type] * info->count; | 1309 | private_size = value_sizes[info->type] * info->count; |
1278 | 1310 | ||
1279 | /* | 1311 | /* |
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index b16dbef04174..cd0e0ebbfdb1 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c | |||
@@ -70,11 +70,11 @@ struct seq_oss_synth { | |||
70 | static int max_synth_devs; | 70 | static int max_synth_devs; |
71 | static struct seq_oss_synth *synth_devs[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS]; | 71 | static struct seq_oss_synth *synth_devs[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS]; |
72 | static struct seq_oss_synth midi_synth_dev = { | 72 | static struct seq_oss_synth midi_synth_dev = { |
73 | -1, /* seq_device */ | 73 | .seq_device = -1, |
74 | SYNTH_TYPE_MIDI, /* synth_type */ | 74 | .synth_type = SYNTH_TYPE_MIDI, |
75 | 0, /* synth_subtype */ | 75 | .synth_subtype = 0, |
76 | 16, /* nr_voices */ | 76 | .nr_voices = 16, |
77 | "MIDI", /* name */ | 77 | .name = "MIDI", |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static DEFINE_SPINLOCK(register_lock); | 80 | static DEFINE_SPINLOCK(register_lock); |
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 293104926098..dcc102813aef 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -165,7 +165,7 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, | |||
165 | snd_seq_timer_update_tick(&tmr->tick, resolution); | 165 | snd_seq_timer_update_tick(&tmr->tick, resolution); |
166 | 166 | ||
167 | /* register actual time of this timer update */ | 167 | /* register actual time of this timer update */ |
168 | do_gettimeofday(&tmr->last_update); | 168 | ktime_get_ts64(&tmr->last_update); |
169 | 169 | ||
170 | spin_unlock_irqrestore(&tmr->lock, flags); | 170 | spin_unlock_irqrestore(&tmr->lock, flags); |
171 | 171 | ||
@@ -392,7 +392,7 @@ static int seq_timer_start(struct snd_seq_timer *tmr) | |||
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | snd_timer_start(tmr->timeri, tmr->ticks); | 393 | snd_timer_start(tmr->timeri, tmr->ticks); |
394 | tmr->running = 1; | 394 | tmr->running = 1; |
395 | do_gettimeofday(&tmr->last_update); | 395 | ktime_get_ts64(&tmr->last_update); |
396 | return 0; | 396 | return 0; |
397 | } | 397 | } |
398 | 398 | ||
@@ -420,7 +420,7 @@ static int seq_timer_continue(struct snd_seq_timer *tmr) | |||
420 | } | 420 | } |
421 | snd_timer_start(tmr->timeri, tmr->ticks); | 421 | snd_timer_start(tmr->timeri, tmr->ticks); |
422 | tmr->running = 1; | 422 | tmr->running = 1; |
423 | do_gettimeofday(&tmr->last_update); | 423 | ktime_get_ts64(&tmr->last_update); |
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
426 | 426 | ||
@@ -444,17 +444,12 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) | |||
444 | spin_lock_irqsave(&tmr->lock, flags); | 444 | spin_lock_irqsave(&tmr->lock, flags); |
445 | cur_time = tmr->cur_time; | 445 | cur_time = tmr->cur_time; |
446 | if (tmr->running) { | 446 | if (tmr->running) { |
447 | struct timeval tm; | 447 | struct timespec64 tm; |
448 | int usec; | 448 | |
449 | do_gettimeofday(&tm); | 449 | ktime_get_ts64(&tm); |
450 | usec = (int)(tm.tv_usec - tmr->last_update.tv_usec); | 450 | tm = timespec64_sub(tm, tmr->last_update); |
451 | if (usec < 0) { | 451 | cur_time.tv_nsec = tm.tv_nsec; |
452 | cur_time.tv_nsec += (1000000 + usec) * 1000; | 452 | cur_time.tv_sec = tm.tv_sec; |
453 | cur_time.tv_sec += tm.tv_sec - tmr->last_update.tv_sec - 1; | ||
454 | } else { | ||
455 | cur_time.tv_nsec += usec * 1000; | ||
456 | cur_time.tv_sec += tm.tv_sec - tmr->last_update.tv_sec; | ||
457 | } | ||
458 | snd_seq_sanity_real_time(&cur_time); | 453 | snd_seq_sanity_real_time(&cur_time); |
459 | } | 454 | } |
460 | spin_unlock_irqrestore(&tmr->lock, flags); | 455 | spin_unlock_irqrestore(&tmr->lock, flags); |
diff --git a/sound/core/seq/seq_timer.h b/sound/core/seq/seq_timer.h index 88dfb71805ae..9506b661fe5b 100644 --- a/sound/core/seq/seq_timer.h +++ b/sound/core/seq/seq_timer.h | |||
@@ -52,7 +52,7 @@ struct snd_seq_timer { | |||
52 | unsigned int skew; | 52 | unsigned int skew; |
53 | unsigned int skew_base; | 53 | unsigned int skew_base; |
54 | 54 | ||
55 | struct timeval last_update; /* time of last clock update, used for interpolation */ | 55 | struct timespec64 last_update; /* time of last clock update, used for interpolation */ |
56 | 56 | ||
57 | spinlock_t lock; | 57 | spinlock_t lock; |
58 | }; | 58 | }; |