1 Star 0 Fork 100

src-NestOS/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0080-misc-Add-parentheses-around-ALIGN_UP-and-ALIGN_DOWN-.patch 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
From 2e5e020db1e1ced5038c5ca9b847f62a224383ff Mon Sep 17 00:00:00 2001
From: Glenn Washburn <development@efficientek.com>
Date: Tue, 8 Dec 2020 16:45:33 -0600
Subject: [PATCH] misc: Add parentheses around ALIGN_UP() and ALIGN_DOWN()
arguments
This ensures that expected order of operations is preserved when arguments
are expressions.
Reference: http://git.savannah.gnu.org/cgit/grub.git/commit/?id=8e8b2316acbaef8c4e6c0839cf27a42217dfb7c3
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
include/grub/misc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 998e47e..08ea894 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -28,10 +28,10 @@
#include <grub/compiler.h>
#define ALIGN_UP(addr, align) \
- ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
+ (((addr) + (typeof (addr)) (align) - 1) & ~((typeof (addr)) (align) - 1))
#define ALIGN_UP_OVERHEAD(addr, align) ((-(addr)) & ((typeof (addr)) (align) - 1))
#define ALIGN_DOWN(addr, align) \
- ((addr) & ~((typeof (addr)) align - 1))
+ ((addr) & ~((typeof (addr)) (align) - 1))
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-nest-os/grub2.git
git@gitee.com:src-nest-os/grub2.git
src-nest-os
grub2
grub2
master

搜索帮助