Message ID | 20240603085602.2351411-7-dominique.martinet@atmark-techno.com |
---|---|
State | RFC |
Headers | show
Return-Path: <swupdate+bncBCWIVBV7SUGRBMEK62ZAMGQEMZE4DQY@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=XbpEft8W; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::53a; helo=mail-pg1-x53a.google.com; envelope-from=swupdate+bncbcwivbv7sugrbmek62zamgqemze4dqy@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-pg1-x53a.google.com (mail-pg1-x53a.google.com [IPv6:2607:f8b0:4864:20::53a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vt6yq350Gz20WM for <incoming@patchwork.ozlabs.org>; Mon, 3 Jun 2024 18:56:19 +1000 (AEST) Received: by mail-pg1-x53a.google.com with SMTP id 41be03b00d2f7-6c554776d0fsf1586202a12.0 for <incoming@patchwork.ozlabs.org>; Mon, 03 Jun 2024 01:56:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717404977; cv=pass; d=google.com; s=arc-20160816; b=CuaLKyM3lm23qELAH6lpAb1pdLAukEcyDZfSVoYQ/Z+wrQ+fha3R9RbEWKsu/S1hpO vJkgw/Ekuaz21YK6ibfJ9kHBnWzspvtCdXRTsuiIPhR/D5E8nnHSh947Vjka8fVfFFDa ZDwH+xDxbmegg9yNyO0KrspbOwi//gLqihE2jdI5pUzJCyjLw4UX8RQSKHxJK4kIfO/t fcYMhA6dnJK4DWWRZGT1CzAj4LIQwzuasNheFV3I/L8JOTDpl32SfNS6oeZKQvQ/HY4y v8kDI9LI9CRgPDT+xgVqXuFLkmaJlig+exKJ3g9ht1KcVbpGFk9AMDD0uJOH/NjExoZl NvXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=NEFYAVWUvBm4koCsc/mSDj7TENeBAlgbzg/peyj+fsA=; fh=UzZAEQkmuNDrjNlWaOaz1xSw40fwKhWu1WoByqIljjA=; b=DvkUlYPGY6v4GBs0E5whbWTbAmlAk5Q4pvNiEhrVkjevRUQk4ZuJ61yGY79TtLlDWV 1BmG/yAq0//TeMMTJ0d3txDCJbvDVWY830J+S1YiKy6HMCuXCfW0xiTpYSxTe/5MeJJL fdLFzSyJ3DSP/GFAe5+qNvrOpq/QZcnZxNIO4r4kwvBuu9/wLU61MTD311kfm6RVwtZY 61vP9Dll+fC+w0GTca6wmoOrm8HPAjRe1+XOsci/JQSUCUb5WnUR8p6Lz7Y3O6/PZkcx ZDdoHdVpHxKXG/GCwTqsAE5H1J3XrqHHbiu+e/Ot5I9PUdaFX9ZVxu9EGg4ObUitFW9L lIng==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=CVGGpgMm; dkim=pass header.i=@atmark-techno.com header.s=google header.b=T2H13Ngc; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1717404977; x=1718009777; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=NEFYAVWUvBm4koCsc/mSDj7TENeBAlgbzg/peyj+fsA=; b=XbpEft8Wuc3URpN4319GbdD7Wzq9QtqfDVTxAUasM6LJN5iI6vQeEJEyDgj8rtqVhP xK61facuCvdjK1mCJsqaPQHjAMV0r13R3SahBSlJAujpJdtW3dn3tIGeC9TWEqTll/cc FZTWQJP4oKk3t0awH1aRP5JVi8AhqbntTGZGGUug9tfiwYLO/SFH2T6vEilvwouGTyGM +bBK/7AZal5GHIkgfkXw5G9M8Ii2WjOeoBqG25DUbZ2URyli12Ud4eobM+QFnxN9pncs lLtK8z2ytiy2PQeK3DU6xjylJFFviBdXatk8eOhg1JSibU1nypqu9hlRbQcWiP6dRww1 DDpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717404977; x=1718009777; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=NEFYAVWUvBm4koCsc/mSDj7TENeBAlgbzg/peyj+fsA=; b=lQExiGZ66w3eNTr9Flcw8CAXs3Ri1Zl6vrypeN5mYyNMDklYkrmzHMO01hn6ArwxZJ uYHPSIFWOFVAKpYB1Z+KFERmWQNKFP1uycYlswGEJV7fsxopX9uM8JBOY2h4Q+DWegA3 yYTvK8hZAvSstifasHTJM3ebrgAS19RatyE+6sv8F0huszx47SoiDVi8nIiPsJvaU+hW 8q71GNhBYqV6fnYq3l0yw5MraCrf0oaTjCC0wLvPLQ42FM3qAsBnVYrqfMgKZJFgy4zB zBe7T9+irnQaIv4xbfl5XUf2bYUYhaY4JyUr6iyD1gU9ApNosyS3LHdZU/RoQga/u3VF moyw== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCUQk+7dQHR63VSfPtZQs1YwBjtduyIO1SSYAcYBJP55/AUQdu+htVuc1tBxwe+cdnp2XKGIc/KPsRfIxzppl8cRNaWSlFi4YBfSnLK6vA== X-Gm-Message-State: AOJu0Yxv4v5wMv7me3+Syxj0HhXY5WPo9SveIDjRHYU+EeaWhB1xuxuO SJ21jUWrJMOCYVMW+HZ0U4FVfD0ef2HZsTZpvL+K0BQRxWO1OR3e X-Google-Smtp-Source: AGHT+IF7IfcZzifBKbEpgJGBwgwy/B1UYGh2emXdtT7t7gMDAVdfGWVXCux4ZvRORpxmqgNg0bJ+3g== X-Received: by 2002:a17:90a:bf87:b0:2bd:d67b:6bf3 with SMTP id 98e67ed59e1d1-2c1acd998ffmr15118021a91.20.1717404976710; Mon, 03 Jun 2024 01:56:16 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:90b:a18:b0:2bf:cf2d:67ea with SMTP id 98e67ed59e1d1-2c1a964dfd4ls329825a91.0.-pod-prod-00-us; Mon, 03 Jun 2024 01:56:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIi4+vFsI8DkkSHDh7DquQrZYnKqshB2107+7AQnBn6nxVZN3kTLOBc6p6Q/CFV1S2SAhhbspipE7TLGyC7QjkJFJWtfR1b48q X-Received: by 2002:a17:90b:1012:b0:2bf:e473:7045 with SMTP id 98e67ed59e1d1-2c1acd998dcmr15692825a91.21.1717404975234; Mon, 03 Jun 2024 01:56:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717404975; cv=none; d=google.com; s=arc-20160816; b=CENvWMjjdBIwo2MsusYUxoP2nGbeOsRvDVKMRXa4spDt4mmx5eJCoyZzZ6MGny4s2C pCOnJmHrCg8Qx9c+t7fxnSqkf8iPSIpACQDNF5QasIvdA3VmvqofK3dPhEeEfCwlQEvk JFqTqkQbilStM6tG0BWqiB005xX3mLDcULd1hLjQSqYgyJjfJVubMvdctWvpupxzDG9K NqQak7tIpwEwRsX9c6ZU27wB1VqVHauKZ2bRGsShJoqMqXXcthBIiMR/aA/HXzLjQ3O4 Y7guRarbiXBpmw2FnWNARRYT03LPzKK9srqYH9DTwczJ3sTzrS8zTSGyISmIYSGgnTP3 7PYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=gegskikDVRK77+/zbXriGChsVAsQhv5LHRSMx6nX0fs=; fh=rbDQRf24e3XQc4FkkwWFPFrQqCfqSrX/atij+XSAC0Q=; b=HUjEVVhbtLBm2DGNYdYD0LlQucHswhnIfOpfwIk6wSNkhHkfHKoAZa03KhTQIPp2GV oW2QfbJ4G9xhY/5dmt/DarFjwpo/+Qd6Ft9r3bAXReGI2iBsgXL0VYZAO+KUPs6EXpGu H6XPi4JyyzYY2J3/OTXdkn35Em+oWFX969UsqYO9VqMHQBAbZYS36vif/XlPQeQPKIph Th9bUs3di7M0WCt5gyLN2QfF1zvINNqAz465cODFQ5IHiHI1kFyrvCP8XrcqSCojOcbx z5eKQhGJajkVvTEoJI69KrZw4Gj4nZdApabLHluhlXNwdPUK6VOeCBMjuS9UlmYFhaYi jiUQ==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=CVGGpgMm; dkim=pass header.i=@atmark-techno.com header.s=google header.b=T2H13Ngc; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com Received: from gw2.atmark-techno.com (gw2.atmark-techno.com. [35.74.137.57]) by gmr-mx.google.com with ESMTPS id 98e67ed59e1d1-2c1b542aee7si1212667a91.0.2024.06.03.01.56.15 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 01:56:15 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) client-ip=35.74.137.57; Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 5C694A2B for <swupdate@googlegroups.com>; Mon, 3 Jun 2024 17:56:13 +0900 (JST) Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 3D4E7A96 for <swupdate@googlegroups.com>; Mon, 3 Jun 2024 17:56:11 +0900 (JST) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-70265fbbb4bso834824b3a.0 for <swupdate@googlegroups.com>; Mon, 03 Jun 2024 01:56:11 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUs2cwG70iineqjsBh2O1bSuvS2SSx/zk102O4FFLmiPyjUwAETwEt6Tgy4jDkNXd44+jJrWUAA+Mo1cA5p+RHmgZXrDH8aYCpH X-Received: by 2002:a05:6a00:3908:b0:6f4:d5d8:e0a3 with SMTP id d2e1a72fcca58-70245709535mr12079884b3a.9.1717404970246; Mon, 03 Jun 2024 01:56:10 -0700 (PDT) X-Received: by 2002:a05:6a00:3908:b0:6f4:d5d8:e0a3 with SMTP id d2e1a72fcca58-70245709535mr12079866b3a.9.1717404969846; Mon, 03 Jun 2024 01:56:09 -0700 (PDT) Received: from pc-0182.atmarktech (35.112.198.104.bc.googleusercontent.com. [104.198.112.35]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242aec7d0sm5220172b3a.99.2024.06.03.01.56.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Jun 2024 01:56:08 -0700 (PDT) Received: from [::1] (helo=pc-0182.atmark.tech) by pc-0182.atmarktech with esmtp (Exim 4.96) (envelope-from <dominique.martinet@atmark-techno.com>) id 1sE3U6-009riT-1D; Mon, 03 Jun 2024 17:56:06 +0900 From: Dominique Martinet <dominique.martinet@atmark-techno.com> To: stefano.babic@swupdate.org, swupdate@googlegroups.com Cc: Dominique Martinet <dominique.martinet@atmark-techno.com> Subject: [swupdate] [PATCH RFC 6/9] cpio_utils: fill_buffer: fix return value on EOF after short read Date: Mon, 3 Jun 2024 17:55:59 +0900 Message-Id: <20240603085602.2351411-7-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240603085602.2351411-1-dominique.martinet@atmark-techno.com> References: <20240603085602.2351411-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@atmark-techno.com header.s=gw2_bookworm header.b=CVGGpgMm; dkim=pass header.i=@atmark-techno.com header.s=google header.b=T2H13Ngc; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 35.74.137.57 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=atmark-techno.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
Proof of concept of chunked checksums
|
expand
|
diff --git a/core/cpio_utils.c b/core/cpio_utils.c index b0a97004baf6..382b22c36434 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -73,7 +73,7 @@ static int _fill_buffer(int fd, unsigned char *buf, unsigned int nbytes, unsigne return -EFAULT; } if (len == 0) { - return 0; + return count; } if (checksum) for (i = 0; i < len; i++)
fill_buffer would return 0 after having filled buffer/updated checksums if it reaches the end of file (returns 0) after another read. In practice, this never happens because the caller knows how much to read, and chunks are smaller than what had been previously written in the pipe so this is a theorical problem, but because the checksums are correctly updated until the end this would not be detected if it happens in practice (the end of the data would just not be fed to the handler), so this is best fixed. Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- core/cpio_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)