From patchwork Mon Jun 25 17:01:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 139869 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4229541lji; Mon, 25 Jun 2018 10:08:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf0qG+2+1UjMHeYJjS6TR2gGOaVVyW2SKCbMxvWkqHoMN0YCV2c9O/+s5HPfL2w70WAAcZO X-Received: by 2002:ae9:dfc2:: with SMTP id t185-v6mr11386868qkf.274.1529946514866; Mon, 25 Jun 2018 10:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529946514; cv=none; d=google.com; s=arc-20160816; b=C3zJo/eHaUb7+780DvhS30xA5RA0b5l6LVwhm2iMzfI6/2XCtDqN7rTkVfjp+/DYUt kvr6RsMqNG93G5liads9vKMU/Do6uZ2qT8Qd7GnRdJ6ZnKXM5M2RkXCv3CyJIq6gBV8v EwwIfgN8PeVo/FheqplWgGV+mfECgokbRMwZhsmg0xvRInuM4/QFLz9vu4IRMcityvwL HXf9TS+UL5nDquXzmaGyl9LbK6WYlP2upkWi/FuCGJlGqN5t87gwtQNbwWM3hr6eOeGX cTokFpozmz8BmLFtv1CXutJtI7NIBUpmOEOiXSbNZLj0sYCcTQBihL+H5QSljnQvU/cE Erzg== 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=nUTvF7axMeOLfaIIdLllzMgEsFRACHC0Gh1wd8y+MZ0=; b=zE13Kkt/4al0fzpw2SLN7w3G3REReGnmtk7cvTvVD1hV4+mrW8mmqpwlgPxAcvKucx e8tSjeMAwU/IYOCTJAaGcUX6oM4nVPmc/Tms6UkqnBHYOybfkIgj8MZiZMSXrHomcO3A GJBeO5hIdWBgU7fSfAjrvlJy7P1nDQXKATe9MaQjxE6NKyYGPRSZyCCfPlppcqZQMbp5 MvrX4wZfXVF31hwp3aayzrfB2Epx3anS6xeuZIwl047PTJPWML/FDAvdgn/tDBjnFmLo PBXpyAOd/eYMv0szhYY0YmvzndwwTIWdk1q4syIADjgRZ7UgdrInAE+Cw7iB80O+nyLr 4sFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=W5dvjoat; 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 y48-v6si1332996qta.177.2018.06.25.10.08.34 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 25 Jun 2018 10:08:34 -0700 (PDT) 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=W5dvjoat; 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]:48385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXUyf-0006XN-Sk for patch@linaro.org; Mon, 25 Jun 2018 13:08:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXUry-0002pJ-KH for grub-devel@gnu.org; Mon, 25 Jun 2018 13:01:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXUrw-0000Ah-Gp for grub-devel@gnu.org; Mon, 25 Jun 2018 13:01:38 -0400 Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:34357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fXUrw-0000AD-AT for grub-devel@gnu.org; Mon, 25 Jun 2018 13:01:36 -0400 Received: by mail-wr0-x22d.google.com with SMTP id a12-v6so14439687wro.1 for ; Mon, 25 Jun 2018 10:01:36 -0700 (PDT) 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=m735bKUcG5yKa2w+4dppIpkX/F3vkB7bRwHZ/6lQ0Ys=; b=W5dvjoatC3Cv6ce0IGEkXxPLBhbg81FDglwzY2+EuNt3i+x71wM+k4s/ZVsg5mDpfI T1Ka4vvkaZ+VQm/zPmMm/uIe9OEar6fQP2OwhjKj+cJQ/lZW7dxLRMU+Cwk4S4dL/w/1 6/MAYQTBK7CwYPvWyb2hST2vdDk7r0kEBK6uw= 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=m735bKUcG5yKa2w+4dppIpkX/F3vkB7bRwHZ/6lQ0Ys=; b=Yl1rP2m5YprA2BXJOVoJ1msCYWLmsh79imSNyf03gSj00Il/EYdn+2L9I/GOra6Lw5 k8O2fByLbkWNcYFWh4FQuIbGef3h8vmkzJxfKsXWZSBEYwcZUT/yV23uplVqB53oUJgv tWxyi1eecTkLQGI20l0KqFNvOaQS4bBhIT6n1yx/Kwh1ernJfE75LL60lwv3NrK/i6xk +a6FkP2xtrAfmZbOy6UgbvMh+Kk+6lcGftnnuARQ5qeBEjqEyjZSNcHrou+2mnAsGjf5 r5XzXvUJkFdI01dqSPIsb06dbYb2kgRUv3kZEeiJg1dXHcxJJ++7ERALYxEtShBCCJMG A3tw== X-Gm-Message-State: APt69E1R5yekBbDX7E0ylUQKWbgTTeKcw2vMKEisNklirDenf0Xv1NjR ++RmQUb9rnc2ehNqPiyCBjPOOolJRQY= X-Received: by 2002:adf:f3d2:: with SMTP id g18-v6mr795187wrp.279.1529946094993; Mon, 25 Jun 2018 10:01:34 -0700 (PDT) Received: from vanye.hemma.eciton.net (cpc92302-cmbg19-2-0-cust304.5-4.cable.virginm.net. [82.1.209.49]) by smtp.gmail.com with ESMTPSA id m58-v6sm23881459wrf.61.2018.06.25.10.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 10:01:33 -0700 (PDT) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH 2/2] commands/file: use definitions from arm64/linux.h Date: Mon, 25 Jun 2018 18:01:29 +0100 Message-Id: <20180625170129.23106-3-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180625170129.23106-1-leif.lindholm@linaro.org> References: <20180625170129.23106-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::22d 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_ARM64 slightly by making use of struct linux_arm_kernel_header and GRUB_LINUX_ARM64_MAGIC_SIGNATURE. Signed-off-by: Leif Lindholm --- grub-core/commands/file.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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 b0fb524b3..6dbb43f0d 100644 --- a/grub-core/commands/file.c +++ b/grub-core/commands/file.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -404,13 +405,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) } case IS_ARM64_LINUX: { - grub_uint32_t sig; + struct linux_arm64_kernel_header lh; - if (grub_file_seek (file, 0x38) == (grub_size_t) -1) - break; - if (grub_file_read (file, &sig, 4) != 4) + if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) break; - if (sig == grub_cpu_to_le32_compile_time (0x644d5241)) + + if (lh.magic == + grub_cpu_to_le32_compile_time (GRUB_LINUX_ARM64_MAGIC_SIGNATURE)) { ret = 1; break;