Skip to contentSkip to conversation

iio:buffer: Wrong sized allocation of demux table elements.

PATCH In review Jonathan Cameron 2 participants 3 messages Aug 8, 2014 IIO

lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

PATCH 1/1 iio:buffer: Wrong sized allocation of demux table elements.

The size of the allocation is currently set to the size of the pointer rather than the structure we should actually be allocating.

---
 drivers/iio/industrialio-buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-buffer.c +1 -1
index 84a952931f9f..ec82cb0bea38 100644
@@ -951,7 +951,7 @@ static int iio_buffer_add_demux(struct iio_buffer *buffer,
 		(*p)->to + (*p)->length == out_loc) {
 		(*p)->length += length;
 	} else {
-		*p = kmalloc(sizeof(*p), GFP_KERNEL);
+		*p = kmalloc(sizeof(**p), GFP_KERNEL);
 		if (*p == NULL)
 			return -ENOMEM;
 		(*p)->from = in_loc;
Signature · 1 line
2.0.3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jonathan Cameron

The size of the allocation is currently set to the size of the pointer rather than the structure we should actually be allocating.

Ok, that answers the earlier question.

Thanks.

Quoted 18 lines
---
  drivers/iio/industrialio-buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-buffer.c +1 -1
index 84a952931f9f..ec82cb0bea38 100644
@@ -951,7 +951,7 @@ static int iio_buffer_add_demux(struct iio_buffer *buffer,
  		(*p)->to + (*p)->length == out_loc) {
  		(*p)->length += length;
  	} else {
-		*p = kmalloc(sizeof(*p), GFP_KERNEL);
+		*p = kmalloc(sizeof(**p), GFP_KERNEL);
  		if (*p == NULL)
  			return -ENOMEM;
  		(*p)->from = in_loc;
author maintainer
#2 lore raw
Quoted 9 lines · Lars-Peter Clausen
Quoted 7 lines · Jonathan Cameron

The size of the allocation is currently set to the size of the pointer rather than the structure we should actually be allocating.

Quoted 5 lines

Ok, that answers the earlier question.

Thanks.

Applied to the togreg branch of iio.git and pushed out as testing...

Thanks,

Quoted 24 lines
Quoted 11 lines
---
  drivers/iio/industrialio-buffer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-buffer.c +0 -0
index 84a952931f9f..ec82cb0bea38 100644

drivers/iio/industrialio-buffer.c static int iio_buffer_add_demux(struct iio_buffer *buffer, · line 957

Quoted 8 lines
drivers/iio/industrialio-buffer.c +1 -1
@@ -951,7 +951,7 @@ static int iio_buffer_add_demux(struct iio_buffer *buffer,
          (*p)->to + (*p)->length == out_loc) {
          (*p)->length += length;
      } else {
-        *p = kmalloc(sizeof(*p), GFP_KERNEL);
+        *p = kmalloc(sizeof(**p), GFP_KERNEL);
          if (*p == NULL)
              return -ENOMEM;
          (*p)->from = in_loc;

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html