iio: buffer: fix custom buffer attributes copy
authorOctavian Purdila <octavian.purdila@intel.com>
Sun, 21 Dec 2014 00:42:26 +0000 (02:42 +0200)
committerJonathan Cameron <jic23@kernel.org>
Mon, 5 Jan 2015 18:59:57 +0000 (18:59 +0000)
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/industrialio-buffer.c

index 2bd8d399f2ecce58a7d2126e04b1e1ea27353b61..403b72878b0b550c983510f5b66a061e563991d6 100644 (file)
@@ -789,7 +789,7 @@ int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
        buffer->buffer_group.attrs[1] = &dev_attr_enable.attr;
        if (buffer->attrs)
                memcpy(&buffer->buffer_group.attrs[2], buffer->attrs,
-                       sizeof(*&buffer->buffer_group.attrs) * (attrcount - 2));
+                       sizeof(*&buffer->buffer_group.attrs) * attrcount);
        buffer->buffer_group.attrs[attrcount+2] = NULL;
 
        indio_dev->groups[indio_dev->groupcounter++] = &buffer->buffer_group;