Message ID | 20210830190133.27155-1-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | 1c877bd8684d8e7743310d0b124ce0f9bf3aee79 |
Headers | show |
Series |
|
Related | show |
Hi Laurent, On Tue, Aug 31, 2021 at 4:01 AM Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > > The bufferLength_ member variabled is checked to have a positive value > before being used, to catch usage before the variable is set. The > variable is initialized to zero at construction time, which renders the > checks useless. > > Fix this by initializing the variable to -1 at construction time. > > Fixes: c5e2ed7806be ("android: camera_buffer: Map buffer in the first plane() call") > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> > --- > I've accidentally applied v3 of "android: camera_buffer: Map buffer in > the first plane() call" before Hiro mentioned a v4 was needed. Sorry > about that. > --- > src/android/mm/generic_camera_buffer.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp > index a41ae2c96023..22efc4d4b13a 100644 > --- a/src/android/mm/generic_camera_buffer.cpp > +++ b/src/android/mm/generic_camera_buffer.cpp > @@ -60,7 +60,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer, > buffer_handle_t camera3Buffer, > libcamera::PixelFormat pixelFormat, > const libcamera::Size &size, int flags) > - : fd_(-1), flags_(flags), bufferLength_(0), mapped_(false) > + : fd_(-1), flags_(flags), bufferLength_(-1), mapped_(false) > { > error_ = 0; > > -- > Regards, > > Laurent Pinchart >
Hi Laurent, On Mon, Aug 30, 2021 at 10:01:33PM +0300, Laurent Pinchart wrote: > The bufferLength_ member variabled is checked to have a positive value > before being used, to catch usage before the variable is set. The > variable is initialized to zero at construction time, which renders the > checks useless. > > Fix this by initializing the variable to -1 at construction time. > > Fixes: c5e2ed7806be ("android: camera_buffer: Map buffer in the first plane() call") > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Thanks j > --- > I've accidentally applied v3 of "android: camera_buffer: Map buffer in > the first plane() call" before Hiro mentioned a v4 was needed. Sorry > about that. > --- > src/android/mm/generic_camera_buffer.cpp | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp > index a41ae2c96023..22efc4d4b13a 100644 > --- a/src/android/mm/generic_camera_buffer.cpp > +++ b/src/android/mm/generic_camera_buffer.cpp > @@ -60,7 +60,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer, > buffer_handle_t camera3Buffer, > libcamera::PixelFormat pixelFormat, > const libcamera::Size &size, int flags) > - : fd_(-1), flags_(flags), bufferLength_(0), mapped_(false) > + : fd_(-1), flags_(flags), bufferLength_(-1), mapped_(false) > { > error_ = 0; > > -- > Regards, > > Laurent Pinchart >
diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp index a41ae2c96023..22efc4d4b13a 100644 --- a/src/android/mm/generic_camera_buffer.cpp +++ b/src/android/mm/generic_camera_buffer.cpp @@ -60,7 +60,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer, buffer_handle_t camera3Buffer, libcamera::PixelFormat pixelFormat, const libcamera::Size &size, int flags) - : fd_(-1), flags_(flags), bufferLength_(0), mapped_(false) + : fd_(-1), flags_(flags), bufferLength_(-1), mapped_(false) { error_ = 0;
The bufferLength_ member variabled is checked to have a positive value before being used, to catch usage before the variable is set. The variable is initialized to zero at construction time, which renders the checks useless. Fix this by initializing the variable to -1 at construction time. Fixes: c5e2ed7806be ("android: camera_buffer: Map buffer in the first plane() call") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- I've accidentally applied v3 of "android: camera_buffer: Map buffer in the first plane() call" before Hiro mentioned a v4 was needed. Sorry about that. --- src/android/mm/generic_camera_buffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)