]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-07-23 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Thu, 23 Jul 2009 16:41:29 +0000 (16:41 +0000)
committerproski <proski@localhost>
Thu, 23 Jul 2009 16:41:29 +0000 (16:41 +0000)
* include/grub/misc.h (ALIGN_UP): Cast align to the type of addr
to avoid loss of upper bits if align is unsigned and shorter
than addr.

ChangeLog
include/grub/misc.h

index a0780abed3223aee70e69504e33db82a5979c9a8..3ceeb08f851bf73921467e29fa04baf7c5622c0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-23  Pavel Roskin  <proski@gnu.org>
+
+       * include/grub/misc.h (ALIGN_UP): Cast align to the type of addr
+       to avoid loss of upper bits if align is unsigned and shorter
+       than addr.
+
 2009-07-21  Vladimir Serbinenko  <phcoder@gmail.com>
 
        UUID support for UFS
index e229062acabeff94b7bf41bf05519e959513384f..769ec5cd830c7f2992981f390ca6ea2bde745a69 100644 (file)
@@ -25,7 +25,8 @@
 #include <grub/symbol.h>
 #include <grub/err.h>
 
-#define ALIGN_UP(addr, align) (((grub_uint64_t)addr + align - 1) & ~(align - 1))
+#define ALIGN_UP(addr, align) \
+       ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
 #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
 
 #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)