{"id":13569,"url":"https://patchwork.libcamera.org/api/1.1/patches/13569/?format=json","web_url":"https://patchwork.libcamera.org/patch/13569/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210830190133.27155-1-laurent.pinchart@ideasonboard.com>","date":"2021-08-30T19:01:33","name":"[libcamera-devel] android: generic_camera_buffer: Fix bufferLength_ initialization","commit_ref":"1c877bd8684d8e7743310d0b124ce0f9bf3aee79","pull_url":null,"state":"accepted","archived":false,"hash":"ab014ae49aa9c6a51389242630f4dcbd3219353c","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13569/mbox/","series":[{"id":2421,"url":"https://patchwork.libcamera.org/api/1.1/series/2421/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2421","date":"2021-08-30T19:01:33","name":"[libcamera-devel] android: generic_camera_buffer: Fix bufferLength_ initialization","version":1,"mbox":"https://patchwork.libcamera.org/series/2421/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13569/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13569/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6BAA1BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Aug 2021 19:01:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 922E26916A;\n\tMon, 30 Aug 2021 21:01:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B7B6B60258\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Aug 2021 21:01:51 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1C0615A7;\n\tMon, 30 Aug 2021 21:01:51 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"L0YUYErQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630350111;\n\tbh=qyDBwf1oE3W8j6UYLySW7MNBX1hHUrcPNZotGhWBsmc=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=L0YUYErQ28kIdWYCDVkY+JY34H81TbSRjqpOA6a1vV2pBG3/palHJqwRSIOtfjtT1\n\tpE8bAeoNBj5thmFczX11Jcl4LA+Fg6QolstvJNtMkKT4M5GLXG3RR5MUBUfTynaXWA\n\tXSm7AyyfVGCpLixHZHm6udnwUCnsLdrKGJFgyY4Y=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 30 Aug 2021 22:01:33 +0300","Message-Id":"<20210830190133.27155-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] android: generic_camera_buffer: Fix\n\tbufferLength_ initialization","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The bufferLength_ member variabled is checked to have a positive value\nbefore being used, to catch usage before the variable is set. The\nvariable is initialized to zero at construction time, which renders the\nchecks useless.\n\nFix this by initializing the variable to -1 at construction time.\n\nFixes: c5e2ed7806be (\"android: camera_buffer: Map buffer in the first plane() call\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\nI've accidentally applied v3 of \"android: camera_buffer: Map buffer in\nthe first plane() call\" before Hiro mentioned a v4 was needed. Sorry\nabout that.\n---\n src/android/mm/generic_camera_buffer.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp\nindex a41ae2c96023..22efc4d4b13a 100644\n--- a/src/android/mm/generic_camera_buffer.cpp\n+++ b/src/android/mm/generic_camera_buffer.cpp\n@@ -60,7 +60,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer,\n \t\t\t       buffer_handle_t camera3Buffer,\n \t\t\t       libcamera::PixelFormat pixelFormat,\n \t\t\t       const libcamera::Size &size, int flags)\n-\t: fd_(-1), flags_(flags), bufferLength_(0), mapped_(false)\n+\t: fd_(-1), flags_(flags), bufferLength_(-1), mapped_(false)\n {\n \terror_ = 0;\n \n","prefixes":["libcamera-devel"]}