diff options
Diffstat (limited to 'kernel/relay.c')
-rw-r--r-- | kernel/relay.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/relay.c b/kernel/relay.c index 8f2179c8056f..760c26209a3c 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -60,7 +60,7 @@ static int relay_buf_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
60 | /* | 60 | /* |
61 | * vm_ops for relay file mappings. | 61 | * vm_ops for relay file mappings. |
62 | */ | 62 | */ |
63 | static struct vm_operations_struct relay_file_mmap_ops = { | 63 | static const struct vm_operations_struct relay_file_mmap_ops = { |
64 | .fault = relay_buf_fault, | 64 | .fault = relay_buf_fault, |
65 | .close = relay_file_mmap_close, | 65 | .close = relay_file_mmap_close, |
66 | }; | 66 | }; |
@@ -677,9 +677,7 @@ int relay_late_setup_files(struct rchan *chan, | |||
677 | */ | 677 | */ |
678 | for_each_online_cpu(i) { | 678 | for_each_online_cpu(i) { |
679 | if (unlikely(!chan->buf[i])) { | 679 | if (unlikely(!chan->buf[i])) { |
680 | printk(KERN_ERR "relay_late_setup_files: CPU %u " | 680 | WARN_ONCE(1, KERN_ERR "CPU has no buffer!\n"); |
681 | "has no buffer, it must have!\n", i); | ||
682 | BUG(); | ||
683 | err = -EINVAL; | 681 | err = -EINVAL; |
684 | break; | 682 | break; |
685 | } | 683 | } |
@@ -797,13 +795,15 @@ void relay_subbufs_consumed(struct rchan *chan, | |||
797 | if (!chan) | 795 | if (!chan) |
798 | return; | 796 | return; |
799 | 797 | ||
800 | if (cpu >= NR_CPUS || !chan->buf[cpu]) | 798 | if (cpu >= NR_CPUS || !chan->buf[cpu] || |
799 | subbufs_consumed > chan->n_subbufs) | ||
801 | return; | 800 | return; |
802 | 801 | ||
803 | buf = chan->buf[cpu]; | 802 | buf = chan->buf[cpu]; |
804 | buf->subbufs_consumed += subbufs_consumed; | 803 | if (subbufs_consumed > buf->subbufs_produced - buf->subbufs_consumed) |
805 | if (buf->subbufs_consumed > buf->subbufs_produced) | ||
806 | buf->subbufs_consumed = buf->subbufs_produced; | 804 | buf->subbufs_consumed = buf->subbufs_produced; |
805 | else | ||
806 | buf->subbufs_consumed += subbufs_consumed; | ||
807 | } | 807 | } |
808 | EXPORT_SYMBOL_GPL(relay_subbufs_consumed); | 808 | EXPORT_SYMBOL_GPL(relay_subbufs_consumed); |
809 | 809 | ||