From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29E98C433EF for ; Sat, 23 Oct 2021 23:28:00 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7EB9960F22 for ; Sat, 23 Oct 2021 23:27:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7EB9960F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C2BA4834AC; Sun, 24 Oct 2021 01:27:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="C+b/ZKKU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 253CB8348B; Sun, 24 Oct 2021 01:27:00 +0200 (CEST) Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ED1FE834D6 for ; Sun, 24 Oct 2021 01:26:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x229.google.com with SMTP id z126so9995351oiz.12 for ; Sat, 23 Oct 2021 16:26:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yRnxuCbuPGEmTCYgaB27PLKo6fCLp8Xin7/SP+2t1Ho=; b=C+b/ZKKUItr2LXIYKjlNxPLvGVMavddYVoAfFDXrUNVg0Taz7DtLGoPDLbY7ISOJo9 mMZ6Ic4CcKZ5N+zhDCMogkhvoDXgsP+lfLU7Zgciw5YJ9JtowEsZPFognwl++zNynPEr bxoS58IZWDUT2YigsIFfkUJIsi3O+Bkeszbho= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yRnxuCbuPGEmTCYgaB27PLKo6fCLp8Xin7/SP+2t1Ho=; b=nadqqu03NW0+Sz5Xvz/kz7vAQ5e4hGOKxZ9Mh3I22L1EJJvq+Dqc6ADZqSC0+fOMoS 9RRJmmy+Rc3rvqHXq7aMmatS1yxSK0nF4RPg+JC46ibpsERZtXKLSc5AP5ZcvuzOxX+m 9Za27NUqDvSi1si5/oAAd8/ttIcgKPNLI760qvp1VHt/f6uqoaGKhDRggnyRs7zYZQzz XmirH9b/fhyfRcWyOHVeMOQhF0jKsNqWuWnwWluvk+0pLg5Hf6bwt+0eHAygtHsEHjPE q+CJxSo9PQeCDNGmXVjx6oryLOJjy2W3iPJGGjwu4RPcUij0YEzP3Ct5xXXNPeT7IRcs Q+WQ== X-Gm-Message-State: AOAM532o1/PQsJJaZHbLbcbryoVgGzlPeQUweUUt36dLiBMmr51F1g0X JmaoukJJ3eGrnZM3+SfrAN66C+E41zu0cA== X-Google-Smtp-Source: ABdhPJz3BY1kTvbbyGOlaN8trSqNtLk/Ics7MG+bqdbGu4gLIEdoyvteLQ+KlWu8wFTLTGBedjflQA== X-Received: by 2002:a05:6808:23cb:: with SMTP id bq11mr5968719oib.139.1635031611525; Sat, 23 Oct 2021 16:26:51 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id l24sm2253885oop.4.2021.10.23.16.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Oct 2021 16:26:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Michal Simek , Heinrich Schuchardt , Tom Rini , Ilias Apalodimas , Daniel Schwierzeck , Steffen Jaeckel , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Lukas Auer , Dennis Gilmore , Simon Glass Subject: [PATCH v2 07/41] mbr: Correct verification check Date: Sat, 23 Oct 2021 17:26:01 -0600 Message-Id: <20211023232635.9195-6-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211023232635.9195-1-sjg@chromium.org> References: <20211023232635.9195-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean At present this command considers the partitions to be identical if the start and size are smaller than expected. It should check that they are the same. Fix this and tidy up the code style a little. Signed-off-by: Simon Glass --- (no changes since v1) cmd/mbr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/mbr.c b/cmd/mbr.c index e7e22980969..c269833eb82 100644 --- a/cmd/mbr.c +++ b/cmd/mbr.c @@ -244,12 +244,12 @@ static int do_verify_mbr(struct blk_desc *dev, const char *str) for (i = 0; i < count; i++) { struct disk_partition p; - if (part_get_info(dev, i+1, &p)) + if (part_get_info(dev, i + 1, &p)) goto fail; - if ((partitions[i].size && p.size < partitions[i].size) || - (partitions[i].start && p.start < partitions[i].start) || - (p.sys_ind != partitions[i].sys_ind)) + if ((partitions[i].size && p.size != partitions[i].size) || + (partitions[i].start && p.start != partitions[i].start) || + p.sys_ind != partitions[i].sys_ind) goto fail; } ret = 0; -- 2.33.0.1079.g6e70778dc9-goog