From patchwork Thu Feb 1 18:18:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 126574 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1954817ljc; Thu, 1 Feb 2018 10:25:47 -0800 (PST) X-Google-Smtp-Source: AH8x227kO5dQAElLBvaHW4N7Hpdc6WmC0FOmksGz0KRT1B4al3LM9OeCNbEHpPVVO8tfc6kgMmtx X-Received: by 10.37.4.84 with SMTP id 81mr25463621ybe.351.1517509547385; Thu, 01 Feb 2018 10:25:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517509547; cv=none; d=google.com; s=arc-20160816; b=FWSjKC1zNBEXBuvNC6XbZq3SUDWE3v/qNAYQORIb9hZyEhSjuPUeuk3fwrs+EFbJfo sC7NslwJymc2xjPzvGD4tEiIqcg+BolB6m2E7w32l0eKLlgZTVdpBmOdBBb/QWjvCI+s dZtzjyb/KmVdFY+rl1RGjkYEbfC+D2WasaoVjT6pb1PzK+wv7SMWUdjImEdBVqz+u6Jx xe846uB13iy+7a09Uh51fZ+JYlQTO0Pf62lrw7jqC/NGwb7t8D2kwgJ05n8pRzYXDtbr MukRkksOVj5I1xSDl1kywgJc3B7hdICAnRhXQXE7+jA4Pqky680ZKKGX+OGzIEcYkOti tmhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:arc-authentication-results; bh=TRjP2n1sw2TefYB0cfMpZTMj89IECMEPFff1Gov650w=; b=UBDK1cp3pdbqePppGutZI7ulejEMQgl04YxxT+GclcxD49GuzP6p9TaeS46YkLFHVI jtI3dpYOfn1Z+73hLq+ktoAvcZN4ygiZcDAoaDm4CzMz1DuqZahhvstAVejP+vXrl52k h3U93SAOMqyUVO44i+uKk375/nZnpHWQDfL2qsGtYRG3TXU0P3Pp8pVwmROMwhxXbix4 9x+OodrL8tefqxmbVKl1JoAA78eRFF9MI1ZTffHdKTHbyDjM9kesjKLK2Jre4z9A+Ogc 4f+KbayufuKgyNuJilE+fvd4pEQ3soYxdUfCkmsnabB631O75jnM2wIaZ16z9/G1ZA+t HbyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MCjAYYf9; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u1si35627ybg.199.2018.02.01.10.25.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Feb 2018 10:25:47 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MCjAYYf9; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJYQ-0008Cu-PV for patch@linaro.org; Thu, 01 Feb 2018 13:25:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJS9-0003tH-Tv for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehJS8-0003ho-8I for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:17 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:39594) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehJS8-0003gM-0r for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:16 -0500 Received: by mail-wr0-x243.google.com with SMTP id f6so18375595wra.6 for ; Thu, 01 Feb 2018 10:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mng1MPrNw+VSuh/7UrbZgcOsLSYgcISJyfq/n7NahzE=; b=MCjAYYf9eLSLA+cdh+GQkqkxqdagZiZApV3+WAgVDSpMV/Elikn+cm55zsFGz5JOyW Ns3hK7Ls67DzeW0mLzBq98QhedGSjG+sql/6SKV4pdM4+CfiPY+UVKFVN8oooPk2DDo2 /lX8HcBpDkBDJwv4IyaKM1f+yKgqZ7YaJBKPc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mng1MPrNw+VSuh/7UrbZgcOsLSYgcISJyfq/n7NahzE=; b=NR0du6i5v3w5//5KA0QsWGo6ukrj2tP+FdJBUcGVmZDFnvaOsqy3xisiZugvIYJOEd zM1cTQoqlZj9Mykz+nfyMv8AlffAAyzP/hESf3eK9OtyGtUk22TbKMcC/hMPf0WiIY7z wB8umOegEGvG8BdZnXhe8CMV7hSxrveWY8BpS9ts7On6JmN5ScZvM3M4/MwEF8UaukKa hchOI1swiBnGQIqSi6WoTsGIsfveG+rifLcPGz3hS8iMHIlx4W4dJvX/Hk2dH7wuTyvv SXOZNxWYHkaZzd6v367hob9KIPiAVB+8AnE8a6iGA5P2pm8tJfKneBRy4optj/giNOy0 jayQ== X-Gm-Message-State: AKwxytdk/zEUqJuivvW2mZpIMFbBmbr7yMN2/aR9dsMRp00693OrzfvI V1iR9vgkxuBbdZjnuXGs/Mote+sTgyM= X-Received: by 10.223.163.195 with SMTP id m3mr11395896wrb.90.1517509154874; Thu, 01 Feb 2018 10:19:14 -0800 (PST) Received: from vanye.hemma.eciton.net (cpc92316-cmbg19-2-0-cust118.5-4.cable.virginm.net. [82.12.0.119]) by smtp.gmail.com with ESMTPSA id b11sm163911wrf.23.2018.02.01.10.19.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 10:19:13 -0800 (PST) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH 09/10] commands/file: use definitions from arm/linux.h Date: Thu, 1 Feb 2018 18:18:57 +0000 Message-Id: <20180201181858.1472-10-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180201181858.1472-1-leif.lindholm@linaro.org> References: <20180201181858.1472-1-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" Clean up code for matching IS_ARM slightly by making use of struct linux_arm_kernel_header and GRUB_LINUX_ARM_MAGIC_SIGNATURE. Signed-off-by: Leif Lindholm --- grub-core/commands/file.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.11.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c index 63c84499b..fad191202 100644 --- a/grub-core/commands/file.c +++ b/grub-core/commands/file.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -383,21 +384,18 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) } case IS_ARM_LINUX: { - grub_uint32_t sig, sig_pi; - if (grub_file_read (file, &sig_pi, 4) != 4) + struct linux_arm_kernel_header lh; + if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) break; /* Raspberry pi. */ - if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006)) + if (lh.code0 == grub_cpu_to_le32_compile_time (0xea000006)) { ret = 1; break; } - if (grub_file_seek (file, 0x24) == (grub_size_t) -1) - break; - if (grub_file_read (file, &sig, 4) != 4) - break; - if (sig == grub_cpu_to_le32_compile_time (0x016f2818)) + if (lh.magic == + grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM_MAGIC_SIGNATURE)) { ret = 1; break;