a5bd9f6
From f57dd7a0c54ee35789d8cb44989622c269342db7 Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
a5bd9f6
Date: Sun, 10 Mar 2013 20:08:15 +0100
a5bd9f6
Subject: [PATCH 207/364] 	* grub-core/lib/arg.c (grub_arg_list_alloc):
a5bd9f6
 Use shifts rather 	than divisions.
a5bd9f6
a5bd9f6
---
a5bd9f6
 ChangeLog           | 5 +++++
a5bd9f6
 grub-core/lib/arg.c | 6 +++---
a5bd9f6
 2 files changed, 8 insertions(+), 3 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index c2821c9..8f8de8b 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,5 +1,10 @@
a5bd9f6
 2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
+	* grub-core/lib/arg.c (grub_arg_list_alloc): Use shifts rather
a5bd9f6
+	than divisions.
a5bd9f6
+
a5bd9f6
+2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
 	* grub-core/commands/verify.c (grub_verify_signature): Use unsigned
a5bd9f6
 	operations to have intended shifts and not divisions.
a5bd9f6
 
a5bd9f6
diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c
a5bd9f6
index da44e30..7492ac6 100644
a5bd9f6
--- a/grub-core/lib/arg.c
a5bd9f6
+++ b/grub-core/lib/arg.c
a5bd9f6
@@ -428,7 +428,7 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc,
a5bd9f6
 {
a5bd9f6
   int i;
a5bd9f6
   char **args;
a5bd9f6
-  unsigned argcnt;
a5bd9f6
+  grub_size_t argcnt;
a5bd9f6
   struct grub_arg_list *list;
a5bd9f6
   const struct grub_arg_option *options;
a5bd9f6
 
a5bd9f6
@@ -440,7 +440,7 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc,
a5bd9f6
   for (i = 0; options[i].doc; i++)
a5bd9f6
     {
a5bd9f6
       if (options[i].flags & GRUB_ARG_OPTION_REPEATABLE)
a5bd9f6
-	argcnt += (argc + 1) / 2 + 1; /* max possible for any option */
a5bd9f6
+	argcnt += ((grub_size_t) argc + 1) / 2 + 1; /* max possible for any option */
a5bd9f6
     }
a5bd9f6
 
a5bd9f6
   list = grub_zalloc (sizeof (*list) * i + sizeof (char*) * argcnt);
a5bd9f6
@@ -456,7 +456,7 @@ grub_arg_list_alloc(grub_extcmd_t extcmd, int argc,
a5bd9f6
       if (options[i].flags & GRUB_ARG_OPTION_REPEATABLE)
a5bd9f6
 	{
a5bd9f6
 	  list[i].args = args;
a5bd9f6
-	  args += argc / 2 + 1;
a5bd9f6
+	  args += (grub_size_t) argc / 2 + 1;
a5bd9f6
 	}
a5bd9f6
     }
a5bd9f6
   return list;
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6