All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keng-Yu Lin <kengyu@hpe.com>
To: grub-devel@gnu.org
Cc: mchang@suse.com, ken.lin@hpe.com, ljk@hpe.com,
	michael.ruan@hpe.com, clayc@hpe.com, kengyu@hpe.com,
	Vladimir Serbinenko <phcoder@gmail.com>
Subject: [PATCH 1/9] strtoull: Fix behaviour on chars between '9' and 'a'.
Date: Fri, 23 Dec 2016 16:54:04 +0800	[thread overview]
Message-ID: <1482483252-8710-2-git-send-email-kengyu@hpe.com> (raw)
In-Reply-To: <1482483252-8710-1-git-send-email-kengyu@hpe.com>

From: Vladimir Serbinenko <phcoder@gmail.com>

Reported by: Aaron Miller <aaronmiller@fb.com>
---
 grub-core/Makefile.core.def           |  5 +++++
 grub-core/kern/misc.c                 | 13 +++++++------
 grub-core/tests/lib/functional_test.c | 13 +++++++++++--
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 2dfa22a..8dcd0e5 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1962,6 +1962,11 @@ module = {
 };
 
 module = {
+  name = strtoull_test;
+  common = tests/strtoull_test.c;
+};
+
+module = {
   name = setjmp_test;
   common = tests/setjmp_test.c;
 };
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index d1a54df..3b633d5 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 d4822a1..96781fb 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.7.4



  reply	other threads:[~2016-12-23  8:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23  8:54 [PATCH v2 0/9] Add UEFI HTTP Boot support for IPv4 and IPv6 Keng-Yu Lin
2016-12-23  8:54 ` Keng-Yu Lin [this message]
2016-12-23  8:54 ` [PATCH 2/9] net: read bracketed ipv6 addrs and port numbers Keng-Yu Lin
2016-12-23  8:54 ` [PATCH v2 3/9] Add default port in grub_net_app_protocol Keng-Yu Lin
2016-12-23  8:54 ` [PATCH 4/9] bootp: New net_bootp6 command Keng-Yu Lin
2016-12-23  8:54 ` [PATCH 5/9] efinet: UEFI IPv6 PXE support Keng-Yu Lin
2016-12-23  8:54 ` [PATCH 6/9] grub.texi: Add net_bootp6 doument Keng-Yu Lin
2016-12-23  8:54 ` [PATCH 7/9] bootp: Add processing DHCPACK packet from HTTP Boot Keng-Yu Lin
2016-12-23  8:54 ` [PATCH 8/9] efinet: Setting network from UEFI device path Keng-Yu Lin
2016-12-23  8:54 ` [PATCH 9/9] efinet: Setting DNS server from UEFI protocol Keng-Yu Lin
2017-01-16  9:07 ` [PATCH v2 0/9] Add UEFI HTTP Boot support for IPv4 and IPv6 Lin, Keng-Yu (HPS OE-Linux TDC)
2017-01-16 10:12   ` Daniel Kiper
2017-07-06  6:52     ` Lin, Keng-Yu
2017-07-10 10:10       ` Michael Chang
2017-07-11  7:39         ` Lin, Keng-Yu
2017-07-11  9:48           ` Michael Chang
2017-07-10 20:41       ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1482483252-8710-2-git-send-email-kengyu@hpe.com \
    --to=kengyu@hpe.com \
    --cc=clayc@hpe.com \
    --cc=grub-devel@gnu.org \
    --cc=ken.lin@hpe.com \
    --cc=ljk@hpe.com \
    --cc=mchang@suse.com \
    --cc=michael.ruan@hpe.com \
    --cc=phcoder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.