linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:buffer: Wrong sized allocation of demux table elements.
@ 2014-08-08  8:43 Jonathan Cameron
  2014-08-08  8:51 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2014-08-08  8:43 UTC (permalink / raw)
  To: linux-iio; +Cc: Jonathan Cameron, Lars-Peter Clausen

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

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: kbuild@01.org
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/iio/industrialio-buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 84a952931f9f..ec82cb0bea38 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -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;
-- 
2.0.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio:buffer: Wrong sized allocation of demux table elements.
  2014-08-08  8:43 [PATCH] iio:buffer: Wrong sized allocation of demux table elements Jonathan Cameron
@ 2014-08-08  8:51 ` Lars-Peter Clausen
  2014-08-08 10:23   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-08-08  8:51 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio

On 08/08/2014 10:43 AM, Jonathan Cameron wrote:
> The size of the allocation is currently set to the size of the pointer
> rather than the structure we should actually be allocating.
>
> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
> Reported-by: kbuild@01.org
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>

Ok, that answers the earlier question.

Thanks.

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

> ---
>   drivers/iio/industrialio-buffer.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 84a952931f9f..ec82cb0bea38 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -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;
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio:buffer: Wrong sized allocation of demux table elements.
  2014-08-08  8:51 ` Lars-Peter Clausen
@ 2014-08-08 10:23   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2014-08-08 10:23 UTC (permalink / raw)
  To: Lars-Peter Clausen, linux-iio

On 08/08/14 09:51, Lars-Peter Clausen wrote:
> On 08/08/2014 10:43 AM, Jonathan Cameron wrote:
>> The size of the allocation is currently set to the size of the pointer
>> rather than the structure we should actually be allocating.
>>
>> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
>> Reported-by: kbuild@01.org
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Cc: Lars-Peter Clausen <lars@metafoo.de>
>
> Ok, that answers the earlier question.
>
> Thanks.
>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch of iio.git and pushed out as testing...

Thanks,
>
>> ---
>>   drivers/iio/industrialio-buffer.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
>> index 84a952931f9f..ec82cb0bea38 100644
>> --- a/drivers/iio/industrialio-buffer.c
>> +++ b/drivers/iio/industrialio-buffer.c
>> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-08 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08  8:43 [PATCH] iio:buffer: Wrong sized allocation of demux table elements Jonathan Cameron
2014-08-08  8:51 ` Lars-Peter Clausen
2014-08-08 10:23   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).