From patchwork Mon Jun 17 07:29:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1948520 Return-Path: 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=bYRnauk3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::f38; helo=mail-qv1-xf38.google.com; envelope-from=swupdate+bncbcwivbv7sugrbtglx6zqmgqemgo3agq@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-qv1-xf38.google.com (mail-qv1-xf38.google.com [IPv6:2607:f8b0:4864:20::f38]) (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 4W2hN42ftrz20Wg for ; Mon, 17 Jun 2024 17:29:22 +1000 (AEST) Received: by mail-qv1-xf38.google.com with SMTP id 6a1803df08f44-6af35481ea6sf55118846d6.1 for ; Mon, 17 Jun 2024 00:29:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718609357; cv=pass; d=google.com; s=arc-20160816; b=Mpn1TAal2k2vFSn/Zp5W7O/X3Tnm1P4vIpDc0Aow42O8cXaSfBkJ5ctFDDUqyHZVb4 qaNDce4OfFY9R5R61l1vx8i8Aiu+2ll70G4lE1lC92VYLEM2HUYrjND0yZ7HSBmUdDf9 PE/OaXKueCjTZhmAcD9c+EY/07qF77x6+bfHRwEoRHgHNBbRpkWGTNWYhADRxkGtvAYN slk1y6SByDCe2X+uleXiVXMuIsO8q1Aawb/AWXZu2gEajYz7PMwoD1+UrECug2ecjBUH 9AqTX/VQF+Yfjzf/p72Vx0/LC98Tz6vBhb14TgZEq8Mn6voDEKrLoqWfStER2cwDBbjG fgVg== 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=PNt4Q24gu9URlX4bX4596ykHcXTLY4z40TNwnotY4X4=; fh=TdA1r2DlbUHD9f5p/yJ5ZGIDPhU1nOuvz3n3p01moNA=; b=dcVzrcpr8tH1S2PcEfoNQwNjCWzlxQtUC8n9gCmqOwT9bSonY5pLNlwfbUUP6XCEao 93Zx2Q4fEO4h/ikSZtw+Ajl2gzTO3rp6282Xmrn5PeSmqly6AJedUqFRY91jXNipDxdq 2y8Zap+b3UQrj9V3mxoLB6n7R9gs9nDdVd9Hr6+uPKriwc5Zt7Px2kwPUuc3n5vxdLiz d7JkD39U4TFuuUS6M5IPn8090DQNFktN894hba2XiQKoH8PWjPYNbBJpBiIumxeXoEB/ L+o8BqUNJggXtpkKZub3CTJ/MDORYdgE2+L2VnyNRnoeD6gHUGJDsI0s5cR+4BII4CrO hw2g==; 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=lZnRAL8P; dkim=pass header.i=@atmark-techno.com header.s=google header.b=H5qHeNFb; 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=1718609357; x=1719214157; 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=PNt4Q24gu9URlX4bX4596ykHcXTLY4z40TNwnotY4X4=; b=bYRnauk3B4jpAMMXYMep/+v4cjmoXyNe45u3jZmcX8phrsDjH4UKEhIZrhpSiaEo2a bvP9HKUciyO1N/qvbgc8ge+O509GuWyq46yf+3IASE3w/kZgEzJY9nWsZOaczReaeo5N nqJ0Q4iw2UsgGHjDAy6z+gOe2LzAsio4SyXf/q/Fjk0AHhokKkojBKdrzappAvej1+te onQbNPj4JJrpoDIzKd8Lra5/6bQOcQ74L6xJuJtvHGCIjipaBXgszKCyHfEdMwITFhcd DLBMSHoSz81XpTHM8sowyLsMFJhnmnORR4YOqG0OvugstiKWcoRw5r7whj40FQPcuVja Ahlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718609357; x=1719214157; 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=PNt4Q24gu9URlX4bX4596ykHcXTLY4z40TNwnotY4X4=; b=CqVF+lFQHTYH+2rt0FThiyyrm4JIZRZ7m3SatVtDOdmg7u9e+3j7lhP375zFsiBkMs SBSl8eGmr37dMWjMeXXsYIkVy1/2uQnHlWgJOd+nHcM2v7SCWaSQhLql5AxD+RZrGAM1 QAzVR+BPvtyiKVWwJg7ZvPRsAyxgG/ibMq4tXmtPsygjRaDujigZuPd/+P7dndc7uW8x 5E9uQMM7ktRodm8sHSz1DpcfzKpfwRy91qVlFt5UtlnZSgEarXdqcYm3MI7ZGXJNMXaC x9sRjVUC5ljJGbJToz0G42EZTVx7ii6lTTW8vKPrjPFQQ03LXacCfLRmsRC1dHFJX6FL 7Sgg== Sender: swupdate@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCXFCPEH9XcgZhH5F1UzcSa+uNtsN3d86KK25uVLvq7UtDEuVC6vfsj5vGZ+4Rp+XaKTOEZSrFX+ZnlZ6lyMSqH9kK8G8fdslPEkjWKIRw== X-Gm-Message-State: AOJu0YwdS0KydD5t/dnSkc0kqoFTVMw/N8gOgOOWDxmctmPHRy9J6hl2 KmgOqRP8cwSP37IqZON95v2UNugqRvaYiDvqpUabZ1irngKu+EMZ X-Google-Smtp-Source: AGHT+IH7kVbY/v5cpgF8WHBTPCA2gCTH0woRk4g28p9wInkrAaNKRRQ+PN3wg6rjkRcfAQ2N+xsLjg== X-Received: by 2002:ad4:4ea9:0:b0:6b0:8f42:2435 with SMTP id 6a1803df08f44-6b2afd6a451mr138740856d6.51.1718609357156; Mon, 17 Jun 2024 00:29:17 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6214:4383:b0:6b0:8070:fdc5 with SMTP id 6a1803df08f44-6b2a8d3eee7ls63263356d6.2.-pod-prod-04-us; Mon, 17 Jun 2024 00:29:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWDwmpbZWsYlHc4ZUjrteL9yiX2Qkf+JOrQfwq4Tu1AGHKtjTHJ8JA4GEfBYlSbrgyhIptVXy8Yw2Td6/qOd4ScQnN/aOjR6u9F X-Received: by 2002:a05:6122:3196:b0:4df:235b:8ba1 with SMTP id 71dfb90a1353d-4ee3f261970mr8111388e0c.7.1718609355645; Mon, 17 Jun 2024 00:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718609355; cv=none; d=google.com; s=arc-20160816; b=BXWgZfZbGz9FkekACvHlbhDTgWA6OJGP/GM/P1tYoIXC8atee9pVT7EmHsqQJ6AU/x jRyB0codHvo10bK7cykCTgNlm9e69uO3nuDm1pohcpJwgeEwbI20Ka7dv5GFvUizaNBi K7De27xcD5/iPd0Vo0UYjChYZrkxT0dLEYVx/l06uOMrSG+P9hSP/70GI/oZCKwVoGG9 /E5eou1cer97kUA2a6Kj+U+R8yoziDWyEaadJeG+m7dU3tqT72c0tSmzEIJY/v8HUuyT BAnlGeH0mEVFOe1pZu856j89LNkqIiX4XeC7EB5hyt0rlbwozlIojEJ73fTm6g830a1n kYnQ== 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=C89MiWLQ+034LYhuSN405yqLRwKjaIj1t6B37p3x1/k=; fh=iqKm7PiuMmizbDEw9lCvRKpkySjdEn9ghL8di9hToes=; b=oOmfCN6yJb6AMcYCoCnG2rlq/t+a0ziLBbGbjD09PcssSmQqDST/0j364sFPSkDdvk TZt+6Yr2HHt+/alCBAwrGar0jLMysYovTB3QxYFDPTrwCw077UuwkOV3yxxi5VgaS+JT NOr5xJK/mFo98RzkX7sFmotzBxLHVFCT7m4lGgvL/VXIR5z4mqUdk8aP1Nc/xxoZT2xV g02BzZAYkrLF1HRAwPgxSJ2AEWgKJphAvvNHBqOvz05LGUffp4juupwQFcN+oBr4TfX9 BkRnRtCo84ZT6jFJdrW0RgAGCpX/FI3PfZgH8aE1ATipHHjHelaGLvP1/b3qdj0acgQD RbxQ==; 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=lZnRAL8P; dkim=pass header.i=@atmark-techno.com header.s=google header.b=H5qHeNFb; 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 71dfb90a1353d-4ed3c6a4bd0si569209e0c.0.2024.06.17.00.29.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 00:29: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 5AB79148 for ; Mon, 17 Jun 2024 16:29:13 +0900 (JST) Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 7965D4A7 for ; Mon, 17 Jun 2024 16:29:12 +0900 (JST) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-649731dd35bso3480440a12.0 for ; Mon, 17 Jun 2024 00:29:12 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWNRwqOQKtho2FoSWruI01x+LHOlq6AVz4eEs3NqjS5thAN3OEQPuP6NGSa6IT6vqogVlfe0trKQGdAMOeH3H5sgrPWMdeZlHkk X-Received: by 2002:a05:6a20:7f9e:b0:1b8:94a0:4a65 with SMTP id adf61e73a8af0-1bae8268dd3mr9346066637.36.1718609351515; Mon, 17 Jun 2024 00:29:11 -0700 (PDT) X-Received: by 2002:a05:6a20:7f9e:b0:1b8:94a0:4a65 with SMTP id adf61e73a8af0-1bae8268dd3mr9346058637.36.1718609351147; Mon, 17 Jun 2024 00:29:11 -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 d9443c01a7336-1f855e559fasm73748055ad.52.2024.06.17.00.29.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2024 00:29:10 -0700 (PDT) Received: from [::1] (helo=pc-0182.atmark.tech) by pc-0182.atmarktech with esmtp (Exim 4.96) (envelope-from ) id 1sJ6nd-009Y52-1T; Mon, 17 Jun 2024 16:29:09 +0900 From: Dominique Martinet To: stefano.babic@swupdate.org, swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH 2/4] cpio_utils: fill_buffer: fix return value on EOF after short read Date: Mon, 17 Jun 2024 16:29:03 +0900 Message-Id: <20240617072905.2275940-3-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240617072905.2275940-1-dominique.martinet@atmark-techno.com> References: <20240617072905.2275940-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=lZnRAL8P; dkim=pass header.i=@atmark-techno.com header.s=google header.b=H5qHeNFb; 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 Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , 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 Acked-by: Stefano Babic --- core/cpio_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/cpio_utils.c b/core/cpio_utils.c index 00b15f030c74..6178fedca216 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++)