From patchwork Thu Feb 11 07:18:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11220 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 EEF0ABD162 for ; Thu, 11 Feb 2021 07:18:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BD5C961664; Thu, 11 Feb 2021 08:18:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LIs+2Qfj"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 505DD61660 for ; Thu, 11 Feb 2021 08:18:39 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7FE2B99D; Thu, 11 Feb 2021 08:18:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1613027919; bh=f9v5E2vNg5DTDL3s4Wf3MBesuAnoDGfL+A2d68zErEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIs+2QfjpTFdqAnlMaiUVv1wcta+HEa/D11rGNKKWbm51X8vuC0t6GwJlz4CVmgSQ NO3xMknY+Y9Tt1DUoOL32hwL5O3cdmaKO4Din3n+irNuJ77fhDNllLOgpyy0YAhrpw xgPn+4tEi3ygoh7zkp3H3YQcoMcm3+hQwkavhrZU= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 11 Feb 2021 16:18:04 +0900 Message-Id: <20210211071805.34963-10-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210211071805.34963-1-paul.elder@ideasonboard.com> References: <20210211071805.34963-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 09/10] 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Niklas Söderlund 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 Reviewed-by: Paul Elder --- 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 2bdce29e..cdb7eae0 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);