Drop 'asm/barrier.h' wrapper
[lttng-modules.git] / src / lttng-abi.c
index c0ab0a488d7cade60defda6404badfc2e7061059..472541a2b89ba5905bd1cdefbd6b2bcd2d50f808 100644 (file)
@@ -23,6 +23,7 @@
  *     - Takes instrumentation source specific arguments.
  */
 
+#include <asm/barrier.h>
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/anon_inodes.h>
@@ -38,7 +39,6 @@
 #include <wrapper/poll.h>
 #include <wrapper/file.h>
 #include <wrapper/kref.h>
-#include <wrapper/barrier.h>
 #include <lttng/string-utils.h>
 #include <lttng/abi.h>
 #include <lttng/abi-old.h>
@@ -650,6 +650,8 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (validate_zeroed_padding(local_counter_read.padding,
                                sizeof(local_counter_read.padding)))
                        return -EINVAL;
+               if (local_counter_read.index.number_dimensions > LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX)
+                       return -EINVAL;
 
                /* Cast all indexes into size_t. */
                for (i = 0; i < local_counter_read.index.number_dimensions; i++)
@@ -685,6 +687,8 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (validate_zeroed_padding(local_counter_aggregate.padding,
                                sizeof(local_counter_aggregate.padding)))
                        return -EINVAL;
+               if (local_counter_aggregate.index.number_dimensions > LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX)
+                       return -EINVAL;
 
                /* Cast all indexes into size_t. */
                for (i = 0; i < local_counter_aggregate.index.number_dimensions; i++)
@@ -716,6 +720,8 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (validate_zeroed_padding(local_counter_clear.padding,
                                sizeof(local_counter_clear.padding)))
                        return -EINVAL;
+               if (local_counter_clear.index.number_dimensions > LTTNG_KERNEL_ABI_COUNTER_DIMENSION_MAX)
+                       return -EINVAL;
 
                /* Cast all indexes into size_t. */
                for (i = 0; i < local_counter_clear.index.number_dimensions; i++)
@@ -724,7 +730,6 @@ long lttng_counter_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                return lttng_kernel_counter_clear(counter, indexes);
        }
        default:
-               WARN_ON_ONCE(1);
                return -ENOSYS;
        }
 }
@@ -1011,7 +1016,7 @@ ssize_t lttng_event_notifier_group_notif_read(struct file *filp, char __user *us
 
        /* Finish copy of previous record */
        if (*ppos != 0) {
-               if (read_count < count) {
+               if (count != 0) {
                        len = chan->iter.len_left;
                        read_offset = *ppos;
                        goto skip_get_next;
@@ -1091,7 +1096,8 @@ nodata:
        chan->iter.len_left = 0;
 
 put_record:
-       lib_ring_buffer_put_current_record(buf);
+       if (*ppos == 0)
+               lib_ring_buffer_put_current_record(buf);
        return read_count;
 }
 
@@ -2277,7 +2283,7 @@ long lttng_abi_event_notifier_group_create_error_counter(
         * in record_error. Ensures the counter is created and the
         * error_counter_len is set before they are used.
         */
-       lttng_smp_store_release(&event_notifier_group->error_counter, counter);
+       smp_store_release(&event_notifier_group->error_counter, counter);
 
        counter->file = counter_file;
        counter->owner = event_notifier_group->file;
This page took 0.024882 seconds and 4 git commands to generate.