From patchwork Thu Feb 1 18:18:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 126570 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1952512ljc; Thu, 1 Feb 2018 10:22:36 -0800 (PST) X-Google-Smtp-Source: AH8x227set5kdp0nX0oVHnlru2S9m7B9w0303/9lWL2D7lw8sRlq1sHDjFn7R3zRx31+DzN9jNdl X-Received: by 10.129.39.143 with SMTP id n137mr25916154ywn.53.1517509356075; Thu, 01 Feb 2018 10:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517509356; cv=none; d=google.com; s=arc-20160816; b=VSKQ2t7Y+LcXKxSdwPJclDe0ZkUI9P6/dChzUvmXjKujTTeOjxUweh0I15lkb8IKti eJ0RTVOWYJ5JEvZDf6h/U/8+w3hbjhDf8x83Voz9QsVhy6Z7O2VY8r1cs7wFVuOaUIRk 066w4B5mQ8ygs7d9QQ7y1vpOLR12NB/TfXORn6KJlgAPRS8qrZvkgCUfZ0YNDk8sYk2W 2JnnooAydwz90BH0iu5q8xOOk7fG/Xj82LH9FtRWlNSNJuLKZVxLLsmo49yG6DQBNAoG Kp4iGdNc84ZDkHMIxcSgH36qV6t1WbMRevlnodWg1jwnIGSOq3KltBCXQviU1oESs552 OTxQ== 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=HchjxBCb3fybc+0cjlSlwY3OppUtnSVkLve2cP2YDZ0=; b=ieToqog/Ff0ZMVrxHnFdk1evh6NT0FlU2wjRLDXDjYDIMraRn2BwJEIRB5YTRMNXpd qPtrQooCKnZ3w6rccpKeXVbAi0x9nI/qGwK2EMaiTyfFP0MKoYBcnR81rGY77mGjR7vr MKdhp+CMmnpuySrPM7QBR48pqUllmZxre4ucPfv5jeYZ6j67UeLTIFlEWngyQ3a3IwN3 kssQmyURSK6ftgqtoQ5HGzmPWoybZ9yqetSOPbxC92s2zFah1RErNw718xbUHpYo844+ hgr38en8gk6viqfVpIAqGdyb6O18Tskw5v6QTjRSdgJmRZb6huRPRLKoXH7o3tlW+LKT Tc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DyfkevZn; 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 f23si33040ybj.460.2018.02.01.10.22.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Feb 2018 10:22:36 -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=DyfkevZn; 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]:52831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJVL-0006FP-GX for patch@linaro.org; Thu, 01 Feb 2018 13:22:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJSA-0003tv-GK 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 1ehJS9-0003lM-LR for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:18 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:46581) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehJS9-0003j9-Es for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:17 -0500 Received: by mail-wr0-x243.google.com with SMTP id g21so20008561wrb.13 for ; Thu, 01 Feb 2018 10:19:17 -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=VAgx3yqpan9OWo9pRjqLIQ66rzVYgsdPC4rUXzojcQA=; b=DyfkevZn2TSc1gkJ+if6V+5cFUtLbcDYjhjvqPAB9bf5t0AMP2lHAQGFMwYVVMP9os 90k8irTMCttahjlnNIMNPz3Uu1z3BB3YNITgTwgQd43OFx66fjzYPnNeCgB8aOVqXWWv bTF9WnSqS06T+ACTtzXNSg8ETPW3MUMh7+MEk= 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=VAgx3yqpan9OWo9pRjqLIQ66rzVYgsdPC4rUXzojcQA=; b=LWYfjfx+UsYPldSIZaNmzxuOR5RkA1ImYKEB8gFsbkZMvNSQTFNFYeFyfGTVjZtPVY bpIyzU9eVQtYDdo+0gaZ7Cx5V20ZmTg6X/LnTwvIdNCt71irkCwQGuWuCMxe/oHjogWL LKzwYi5QNHlE2pfc4o35X+Kz6KSq9+fCp747fmtI3yZ/6CUL4qxI0DADFksAUiBN7txI Gfm89jDon4+67hMaLriAZcwskmw1Xufk3u4y1oR/m1byixJ6DqJ9Wb22ZsTPBf6TBOYK Qe3eGu1b7JBpVwrBDJJv9tnDF+jONDt5x/dUft2alvvvB47YYU9bcHdKvj6mj8m9cILF B/ow== X-Gm-Message-State: AKwxytfcWx2f8agy/TLDQgRKPeNf03Q0taOv0EGWKh4CJ4RGoDLpE9SN pT4MSZBlyR1oUKgXuSBFdZmQ4Yb9/Y8= X-Received: by 10.223.153.240 with SMTP id y103mr16515284wrb.36.1517509156252; Thu, 01 Feb 2018 10:19:16 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 10:19:15 -0800 (PST) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH 10/10] commands/file: use definitions from arm64/linux.h Date: Thu, 1 Feb 2018 18:18:58 +0000 Message-Id: <20180201181858.1472-11-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_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 Reviewed-by: Daniel Kiper diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c index fad191202..dd729a8a8 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;