14 Star 0 Fork 3

src-openEuler/rt-tests

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
deadline_test-Increase-buffer-to-avoid-overflow.patch 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
RyanL 提交于 2023-02-23 15:46 +08:00 . Package init
From 33dff61afb032e5374c6ec60d4f88cdf57e83c53 Mon Sep 17 00:00:00 2001
From: Daniel Wagner <wagi@monom.org>
Date: Mon, 19 Aug 2019 08:43:04 +0200
Subject: [PATCH 04/10] deadline_test: Increase buffer to avoid overflow
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Increase the size of the char buffer. gcc 9.1.1 reports:
src/sched_deadline/deadline_test.c:1803:24: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
1803 | sprintf(setcpu_buf, "%d", cpu_count - 1);
| ^~
src/sched_deadline/deadline_test.c:1803:23: note: directive argument in the range [-2147483648, 2147483646]
1803 | sprintf(setcpu_buf, "%d", cpu_count - 1);
| ^~~~
src/sched_deadline/deadline_test.c:1803:3: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10
1803 | sprintf(setcpu_buf, "%d", cpu_count - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
src/sched_deadline/deadline_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index e2898de328bb..5b5f40dbb74d 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -1795,7 +1795,7 @@ int main (int argc, char **argv)
/* -b has us bind to the last CPU. */
if (!all_cpus && !setcpu) {
- setcpu_buf = malloc(10);
+ setcpu_buf = malloc(12);
if (!setcpu_buf) {
perror("malloc");
exit(-1);
--
2.20.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/rt-tests.git
git@gitee.com:src-openeuler/rt-tests.git
src-openeuler
rt-tests
rt-tests
master

搜索帮助