From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=G3tltgwX; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 11E2B5A026E for ; Wed, 18 Sep 2024 12:44:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1726656248; bh=Z/uJh42bN/+W1dqmAmNcMBAfBNich4m/y4ouh4jWdNs=; h=From:To:Cc:Subject:Date:From; b=G3tltgwXt1WPv3D+1zTofXZYd6mNQfQT3J57STTwtV3xHCHHsItGQ8qA2TK32ooe7 8UAWUo/CGk0fu8nMX4djhu12PYIpqYsKl7xvSZ8MQw4Gon1Bn7MycVUx+PBQlIQE1x GeParqoEUSHiB7FJ8NsXCcHUyTYvHeR0JZk7wDzPo836JKolEFEMo86cX+YW5mR2Yt MwRP9cQGwPf4uj73wvr1zWIFtiveKTdLDo3TKHA88hwanPOW02QximgZ7fjQXWVVrW gZ97frzH4iBpDm+AvXQk/E3wUvJCvBfbxJXMuu0zdGBv4RtMncCJZpNs655m+C0718 FWa8W7MzyYutA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4X7wHr5GrBz4x6l; Wed, 18 Sep 2024 20:44:08 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 0/2] util: Fix some problems in write_remainder() Date: Wed, 18 Sep 2024 20:44:04 +1000 Message-ID: <20240918104406.3050878-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: DXR3WCTBC3PGL2ASPNSXS7TRFR4SWUGR X-Message-ID-Hash: DXR3WCTBC3PGL2ASPNSXS7TRFR4SWUGR X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Markus Armbruster , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: With Markus Armbruster's help I re-examined the Coverity warning we've had in this function for a while. While I still don't understand some steps in the report it's giving, I did spot some real problems in the vicinity. It turns out fixing those also fixes the Coverity warning, so here we go. Changes since v2: * Handle EINTR within write_all_buf() (suggested by Markus Armbruster) David Gibson (2): util: Add helper to write() all of a buffer util: Remove possible quadratic behaviour from write_remainder() pcap.c | 3 +-- util.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- util.h | 1 + 3 files changed, 43 insertions(+), 11 deletions(-) -- 2.46.0