Patch Detail
Show a patch.
GET /api/patches/15592/?format=api
{ "id": 15592, "url": "https://patchwork.libcamera.org/api/patches/15592/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15592/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220331154526.27882-1-laurent.pinchart@ideasonboard.com>", "date": "2022-03-31T15:45:26", "name": "[libcamera-devel] libcamera: v4l2_videodevice: Fix potential errno overwrite", "commit_ref": "f9e2df951969f10f1ee1e46fb806942a27db8aca", "pull_url": null, "state": "accepted", "archived": false, "hash": "1f2b442877d0fa7f24e3afb3453457d22339074a", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15592/mbox/", "series": [ { "id": 3019, "url": "https://patchwork.libcamera.org/api/series/3019/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3019", "date": "2022-03-31T15:45:26", "name": "[libcamera-devel] libcamera: v4l2_videodevice: Fix potential errno overwrite", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3019/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15592/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15592/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 56BDDC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 31 Mar 2022 15:45:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A9B9065631;\n\tThu, 31 Mar 2022 17:45:33 +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 2E8D86559A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Mar 2022 17:45:32 +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 A47A82F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 31 Mar 2022 17:45:31 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648741533;\n\tbh=y2xadYNexbxTmTSspByeeHY/7YsXVXyX+p37PKm7CXM=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=CvJvNWiWXQEAN3Gx88LWv/dzBJnbSPOAc2gccsif39mbtX9Lihw24/unnKmTIV8Al\n\tp+cJKmtuxCMyie5c6x7i/cl0LXJoE8uvGeowsB9V2kmlSj63G+/R+q0us3RQMTxYMO\n\trtovatpY1QqLJmLFCman9u0vVpz4jXkxHUtAFoxA8GQ3oMiSNkp+YBUiQubN5T9DjM\n\tv9N6svMwM8gTfdRQD1BQAzOk960YxPradtl+B3C37o4A/uXv4vdqK6K1Am307OVBU0\n\tXCyXlUc3+yI1jjoXt53ikbBTL+nqxKvhCRV1RqdfdiT/kRscysscmlod3Jn2ePB/lM\n\t8FJqcLb9OtVzA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648741531;\n\tbh=y2xadYNexbxTmTSspByeeHY/7YsXVXyX+p37PKm7CXM=;\n\th=From:To:Subject:Date:From;\n\tb=lz4/Fnt2yDm7pHrCpeWF+7RW6BALOZ2A7OjOWoELDHYTw5FKaHG0GUhGiCJOjUPp3\n\tt4YcUcBjjSKCYN52Oo9Ty6eTzNm9WOrPMi7kCqTbBizwko5aX2PPEkWt7nxAzca0dU\n\tJhCkKEu5D3wpfQrqunYC2xSURKczZhrOsrmdW1mU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"lz4/Fnt2\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 31 Mar 2022 18:45:26 +0300", "Message-Id": "<20220331154526.27882-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: v4l2_videodevice: Fix\n\tpotential errno overwrite", "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>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The errno variable can potentially be overwritten by operator<<(). Store\nit in a local variable before logging the error message.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 009f6d55610f..0830be80c553 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -647,14 +647,17 @@ int V4L2VideoDevice::open()\n */\n int V4L2VideoDevice::open(SharedFD handle, enum v4l2_buf_type type)\n {\n+\tint ret;\n+\n \tUniqueFD newFd = handle.dup();\n \tif (!newFd.isValid()) {\n+\t\tret = -errno;\n \t\tLOG(V4L2, Error) << \"Failed to duplicate file handle: \"\n-\t\t\t\t << strerror(errno);\n-\t\treturn -errno;\n+\t\t\t\t << strerror(-ret);\n+\t\treturn ret;\n \t}\n \n-\tint ret = V4L2Device::setFd(std::move(newFd));\n+\tret = V4L2Device::setFd(std::move(newFd));\n \tif (ret < 0) {\n \t\tLOG(V4L2, Error) << \"Failed to set file handle: \"\n \t\t\t\t << strerror(-ret);\n", "prefixes": [ "libcamera-devel" ] }