[libcamera-devel,5/5] libcamera: MappedBuffer: Delete copy and assignment
diff mbox series

Message ID 20201022135605.614240-6-kieran.bingham@ideasonboard.com
State Superseded
Delegated to: Kieran Bingham
Headers show
Series
  • Delete Copy-Move-Assign
Related show

Commit Message

Kieran Bingham Oct. 22, 2020, 1:56 p.m. UTC
Prevent copying and assignment of MappedBuffer types, which could invoke unmapping
or mapped memory.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/internal/buffer.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Laurent Pinchart Oct. 23, 2020, 4:41 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Thu, Oct 22, 2020 at 02:56:05PM +0100, Kieran Bingham wrote:
> Prevent copying and assignment of MappedBuffer types, which could invoke unmapping
> or mapped memory.

Line wrap ?

> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  include/libcamera/internal/buffer.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
> index b7b0173f93f5..8c7126482b95 100644
> --- a/include/libcamera/internal/buffer.h
> +++ b/include/libcamera/internal/buffer.h
> @@ -10,6 +10,7 @@
>  #include <sys/mman.h>
>  #include <vector>
>  
> +#include <libcamera/class.h>
>  #include <libcamera/buffer.h>
>  #include <libcamera/span.h>
>  
> @@ -34,6 +35,9 @@ protected:
>  
>  	int error_;
>  	std::vector<Plane> maps_;
> +
> +private:
> +	DELETE_COPY_AND_ASSIGN(MappedBuffer);
>  };
>  
>  class MappedFrameBuffer : public MappedBuffer
Kieran Bingham Oct. 23, 2020, 8:28 a.m. UTC | #2
On 23/10/2020 05:41, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Thu, Oct 22, 2020 at 02:56:05PM +0100, Kieran Bingham wrote:
>> Prevent copying and assignment of MappedBuffer types, which could invoke unmapping
>> or mapped memory.
> 
> Line wrap ?

How has this happened on every patch. Normally my editor does this for
me ! :-(



> 
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>  include/libcamera/internal/buffer.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
>> index b7b0173f93f5..8c7126482b95 100644
>> --- a/include/libcamera/internal/buffer.h
>> +++ b/include/libcamera/internal/buffer.h
>> @@ -10,6 +10,7 @@
>>  #include <sys/mman.h>
>>  #include <vector>
>>  
>> +#include <libcamera/class.h>
>>  #include <libcamera/buffer.h>
>>  #include <libcamera/span.h>
>>  
>> @@ -34,6 +35,9 @@ protected:
>>  
>>  	int error_;
>>  	std::vector<Plane> maps_;
>> +
>> +private:
>> +	DELETE_COPY_AND_ASSIGN(MappedBuffer);
>>  };
>>  
>>  class MappedFrameBuffer : public MappedBuffer
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
index b7b0173f93f5..8c7126482b95 100644
--- a/include/libcamera/internal/buffer.h
+++ b/include/libcamera/internal/buffer.h
@@ -10,6 +10,7 @@ 
 #include <sys/mman.h>
 #include <vector>
 
+#include <libcamera/class.h>
 #include <libcamera/buffer.h>
 #include <libcamera/span.h>
 
@@ -34,6 +35,9 @@  protected:
 
 	int error_;
 	std::vector<Plane> maps_;
+
+private:
+	DELETE_COPY_AND_ASSIGN(MappedBuffer);
 };
 
 class MappedFrameBuffer : public MappedBuffer