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