From patchwork Mon May 25 02:49:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jason Andryuk X-Patchwork-Id: 11567885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47B3213B4 for ; Mon, 25 May 2020 02:51:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23CF72075F for ; Mon, 25 May 2020 02:51:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L6qXpcjj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23CF72075F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jd3CR-0004LJ-CW; Mon, 25 May 2020 02:50:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jd3CQ-0004L8-Id for xen-devel@lists.xenproject.org; Mon, 25 May 2020 02:50:46 +0000 X-Inumbo-ID: 884632d8-9e32-11ea-9887-bc764e2007e4 Received: from mail-qv1-xf44.google.com (unknown [2607:f8b0:4864:20::f44]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 884632d8-9e32-11ea-9887-bc764e2007e4; Mon, 25 May 2020 02:50:46 +0000 (UTC) Received: by mail-qv1-xf44.google.com with SMTP id l3so7511743qvo.7 for ; Sun, 24 May 2020 19:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ds4Pyg1znJ3S0Yg3vWRMgNmyuvMQ1euqy6dagIketK0=; b=L6qXpcjjOcA1qYvY32zs5lbEBNrn4lYO4CNDF/NB7xae9LlITGYHYax3YmsIOiM+Sp jtSgD7NFMXilhhjJvcKaB3m53Bb3FHtw1MTeTrtnjfcdm0gDch061xr58+AaSlt2JGay E7v7NdpspaHZnLR2/3kVuluY4k5xPHwNyG8bb8yjNZALerzj8ZK/4p7Fqr2Fjo0Htb2R b65Ga0UDcyvOLQMMAp56Db8WjfO2k7mIKbwSOxxIcYrkADN0d3kt3FZ5eElN0wMmRrI9 f29GsizKwpS0oNNoiBwWDbcBLnsafwZw0tyT8JfD0eGotV1EQw7nS9eN7TlY5BmZb+Yd 6NwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ds4Pyg1znJ3S0Yg3vWRMgNmyuvMQ1euqy6dagIketK0=; b=Vm+n91htwbg7m5fqhnwN+iCew+vnvZjHFIadjLuAzhVFM93aDAV5xels6jX6Cs/+ak HPWmV1/5iKC3fPjtWmTw8ZFYiIWPFgbtK/6VZHOIRp6JiCVCNaNT9hETcjgIbOiurkky zCMjwjLd2d/ThBx5Ak9ZVVK7RoWsGnts5HlXD7kFcM0DEptyDPWfcvT1mg5hUiQADBYp OiKBe2VwiQA8O5qcphxCAsuSVqZ6Xg89Q3x0gAExtvOLvS1sGFZgW07KVHrP6cwHZ2JT wZ77pvMRtwtT9rYQItfmoOdmgRXoaUFGSylrmK5DQG3kIKF5sEzdnDixT/6k2iOP+qLe dl9w== X-Gm-Message-State: AOAM533Vbfo7248m7BGsCGGTwEgOznCy/WRVhg4NeRtfPk+dLFNwTI2h rHLRLl9S116A9YDbEArbdskogCuD X-Google-Smtp-Source: ABdhPJwVY4tyeXHUFHKqVTHep4vSGYq3+fpnSZ41i5Zzo0H8ntsDwuXfy/s0AQhbGmkAQpLlA5F9mg== X-Received: by 2002:a05:6214:8e4:: with SMTP id dr4mr13187822qvb.97.1590375045443; Sun, 24 May 2020 19:50:45 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:344b:9349:9475:b6a2]) by smtp.gmail.com with ESMTPSA id h134sm13539512qke.6.2020.05.24.19.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 19:50:44 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH 0/8] Coverity fixes for vchan-socket-proxy Date: Sun, 24 May 2020 22:49:47 -0400 Message-Id: <20200525024955.225415-1-jandryuk@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , marmarek@invisiblethingslab.com, Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This series addresses some Coverity reports. To handle closing FDs, a state struct is introduced to track FDs closed in both main() and data_loop(). Jason Andryuk (8): vchan-socket-proxy: Ensure UNIX path NUL terminated vchan-socket-proxy: Check xs_watch return value vchan-socket-proxy: Unify main return value vchan-socket-proxy: Use a struct to store state vchan-socket-proxy: Switch data_loop() to take state vchan-socket-proxy: Set closed FDs to -1 vchan-socket-proxy: Cleanup resources on exit vchan-socket-proxy: Handle closing shared input/output_fd tools/libvchan/vchan-socket-proxy.c | 164 ++++++++++++++++++---------- 1 file changed, 106 insertions(+), 58 deletions(-) Reviewed-by: Marek Marczykowski-Górecki