grub2/0012-strtoull-Fix-behaviour-on-chars-between-9-and-a.patch
Peter Jones 81987f4958 Update grub2 for f28
- Try to fix things for new compiler madness.
  I really don't know why gcc decided __attribute__((packed)) on a "typedef
  struct" should imply __attribute__((align (1))) and that it should have a
  warning that it does so.  The obvious behavior would be to keep the alignment
  of the first element unless it's used in another object or type that /also/
  hask the packed attribute.  Why should it change the default alignment at
  all?
- Merge in the BLS patches Javier and I wrote.
- Attempt to fix pmtimer initialization failures to not be super duper slow.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-02-28 09:40:44 -05:00

68 lines
1.8 KiB
Diff

From dc6e1b5af83eb1c4290baf97c2d221c0865127be Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Wed, 10 Aug 2016 17:49:42 +0200
Subject: [PATCH 012/206] strtoull: Fix behaviour on chars between '9' and 'a'.
Reported by: Aaron Miller <aaronmiller@fb.com>
---
grub-core/kern/misc.c | 13 +++++++------
grub-core/tests/lib/functional_test.c | 13 +++++++++++--
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index d1a54df6c12..3b633d51f4c 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -391,12 +391,13 @@ grub_strtoull (const char *str, char **end, int base)
unsigned long digit;
digit = grub_tolower (*str) - '0';
- if (digit > 9)
- {
- digit += '0' - 'a' + 10;
- if (digit >= (unsigned long) base)
- break;
- }
+ if (digit >= 'a' - '0')
+ digit += '0' - 'a' + 10;
+ else if (digit > 9)
+ break;
+
+ if (digit >= (unsigned long) base)
+ break;
found = 1;
diff --git a/grub-core/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c
index d4822a12456..96781fb39b5 100644
--- a/grub-core/tests/lib/functional_test.c
+++ b/grub-core/tests/lib/functional_test.c
@@ -26,14 +26,23 @@ GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_functional_test (grub_extcmd_context_t ctxt __attribute__ ((unused)),
- int argc __attribute__ ((unused)),
- char **args __attribute__ ((unused)))
+ int argc,
+ char **args)
{
grub_test_t test;
int ok = 1;
+ int i;
FOR_LIST_ELEMENTS (test, grub_test_list)
{
+ if (argc != 0)
+ {
+ for (i = 0; i < argc; i++)
+ if (grub_strcmp(args[i], test->name) == 0)
+ break;
+ if (i == argc)
+ continue;
+ }
grub_errno = 0;
ok = ok && !grub_test_run (test);
grub_errno = 0;
--
2.15.0