From patchwork Mon Feb 8 23:47:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 11201 X-Patchwork-Delegate: paul.elder@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BD1DBBD162 for ; Mon, 8 Feb 2021 23:47:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D535C6160C; Tue, 9 Feb 2021 00:47:55 +0100 (CET) Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 31AF960D3A for ; Tue, 9 Feb 2021 00:47:54 +0100 (CET) X-Halon-ID: 0f651e7c-6a68-11eb-a076-005056917f90 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p4fca2458.dip0.t-ipconnect.de [79.202.36.88]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 0f651e7c-6a68-11eb-a076-005056917f90; Tue, 09 Feb 2021 00:47:53 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Paul Elder Date: Tue, 9 Feb 2021 00:47:32 +0100 Message-Id: <20210208234733.2637061-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210208234733.2637061-1-niklas.soderlund@ragnatech.se> References: <20210208234733.2637061-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 1/2] libcamera: IPCPipeUnixSocket: Check that insertion succeeds X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libcamera-devel@lists.libcamera.org Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Make sure the insertion succeeds. This was found by compile tests with gcc7 which points out 'success' is not used. ../../src/libcamera/ipc_pipe_unixsocket.cpp:119:27: error: unused variable ‘success’ [-Werror=unused-variable] const auto [iter, success] = callData_.insert({ cookie, { response, false } }); Signed-off-by: Niklas Söderlund --- src/libcamera/ipc_pipe_unixsocket.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcamera/ipc_pipe_unixsocket.cpp b/src/libcamera/ipc_pipe_unixsocket.cpp index 2bdce29e24d9acd1..cdb7eae0653384eb 100644 --- a/src/libcamera/ipc_pipe_unixsocket.cpp +++ b/src/libcamera/ipc_pipe_unixsocket.cpp @@ -118,6 +118,11 @@ int IPCPipeUnixSocket::call(const IPCUnixSocket::Payload &message, const auto [iter, success] = callData_.insert({ cookie, { response, false } }); + if (!success) { + LOG(IPCPipe, Error) << "Failed to insert call data"; + return -EINVAL; + } + ret = socket_->send(message); if (ret) { callData_.erase(iter);