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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 19563C001DE for ; Sun, 13 Aug 2023 14:29:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4C9DD86996; Sun, 13 Aug 2023 16:27:41 +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="KDaXbwC9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D98A48696B; Sun, 13 Aug 2023 16:27:37 +0200 (CEST) Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 D015D8696B for ; Sun, 13 Aug 2023 16:27:35 +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-il1-x12f.google.com with SMTP id e9e14a558f8ab-3492e8fb906so17316155ab.3 for ; Sun, 13 Aug 2023 07:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691936854; x=1692541654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1ZxiwTwr4AHzxBC0rYhFC4gQYeFtijBg3yfVMeCxkt0=; b=KDaXbwC9CDU0ZeeKky+j0QQKgHuHQOICwgd2BR/EKLEkRqA1cSkDLjO/Flvn3qUl7c A6AdIaIUm/oRQpHS+zOyueYmgsPthyE8CwJt3KDKu3vusEaI7piLZiVxdvxXSzAEsd+P kmayBVbcZZJymAHBwOl7e1P00AS/KyRVGu86o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691936854; x=1692541654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ZxiwTwr4AHzxBC0rYhFC4gQYeFtijBg3yfVMeCxkt0=; b=JLHe5u5e/ShfvpdfP+kY1GBMnLJCvhRB8kATC7RBOXVtaNm71v9RHvjCS9W7qSEtA8 ELPwyV3RoU3QkKagaCfY2xDpSsNEd6w2+1aG46GLkIaB5RAHCm1QXQfqBptmTOws1PWF KXzrTyUwWm6ZbOi/ublMVZyJj6+y/Im+lS3/oVYo/9xa5imVWfPj0vNIfo71gGcCqGuj +1XGU4Ei1rJRBiBy6AUcZrj35OKQP8UIiFEDck4zSgfhKtpWwxPkZGyk+XQmMNumj9bt 7DGKwvbIitUMAe7chbS3YOy9vrYDmeGn4Y8Bz9mh8OPbYqxewzuLVF966qLItCHMG9oq xb2A== X-Gm-Message-State: AOJu0Yzy7vhvg3GiRKmriUrdalL7bdOtiI5pQMrcEgms8PwtyqkhUn/x Pwj7NVLQZ8DD44AdiWHGHNFtwXac9ivDY0odnck= X-Google-Smtp-Source: AGHT+IHf9hRtbVYi/xhdAT/OyJpUoG4wPlZGU6xDLg3N/Y2pPRj4RF9HEcyA5snANCt+JdTnKBNmbQ== X-Received: by 2002:a05:6e02:1aa1:b0:349:4c29:382f with SMTP id l1-20020a056e021aa100b003494c29382fmr12271042ilv.28.1691936854500; Sun, 13 Aug 2023 07:27:34 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id w7-20020a02cf87000000b00430cf006d9bsm2280952jar.30.2023.08.13.07.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 07:27:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 11/24] part: efi: Add debugging for the signature check Date: Sun, 13 Aug 2023 08:26:39 -0600 Message-ID: <20230813142708.361456-12-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230813142708.361456-1-sjg@chromium.org> References: <20230813142708.361456-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Add a little more debugging for the initial signature check. Drop the pointless check for NULL. Also set a log category while we are here. Signed-off-by: Simon Glass --- disk/part_efi.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index 208675213822..39382c5faee0 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -9,6 +9,9 @@ * when CONFIG_SYS_64BIT_LBA is not defined, lbaint_t is 32 bits; this * limits the maximum size of addressable storage to < 2 tebibytes */ + +#define LOG_CATEGORY LOGC_FS + #include #include #include @@ -976,17 +979,23 @@ static int pmbr_part_valid(struct partition *part) /* * is_pmbr_valid(): test Protective MBR for validity * + * @mbr: Pointer to Master Boot-Record data + * * Returns: 1 if PMBR is valid, 0 otherwise. * Validity depends on two things: * 1) MSDOS signature is in the last two bytes of the MBR * 2) One partition of type 0xEE is found, checked by pmbr_part_valid() */ -static int is_pmbr_valid(legacy_mbr * mbr) +static int is_pmbr_valid(legacy_mbr *mbr) { + uint sig = le16_to_cpu(mbr->signature); int i = 0; - if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE) + if (sig != MSDOS_MBR_SIGNATURE) { + log_debug("Invalid signature %x\n", sig); return 0; + } + log_debug("Signature %x valid\n", sig); for (i = 0; i < 4; i++) { if (pmbr_part_valid(&mbr->partition_record[i])) { -- 2.41.0.640.ga95def55d0-goog