!46 [sync] PR-45: fix opendir fails in check_platform_device

From: @openeuler-sync-bot
Reviewed-by: @wangbin224
Signed-off-by: @wangbin224
This commit is contained in:
openeuler-ci-bot 2021-08-24 07:47:34 +00:00 committed by Gitee
commit fc1ac67f3d
2 changed files with 61 additions and 2 deletions

View File

@ -0,0 +1,52 @@
From a9f0290a6754a475eb95818dd38dc401370da071 Mon Sep 17 00:00:00 2001
From: liuchao173 <55137861+liuchao173@users.noreply.github.com>
Date: Mon, 23 Aug 2021 19:40:41 +0800
Subject: [PATCH] fix opendir fails in check_platform_device
When irq name does not contain spaces, savedptr is an empty string and irq_fullname will have a extra space at the end like "
LNRO0005:00 ".
So opendir in check_platform_device will fail, and irqbalance prints log:
"No directory /sys/devices/platform/LNRO0005:00 /: No such file or directory"
---
procinterrupts.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/procinterrupts.c b/procinterrupts.c
index 32c5e53..2bd201b 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -183,20 +183,17 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
}
#ifdef AARCH64
- irq_name = last_token;
- tmp = strchr(irq_name, '\n');
- if (tmp)
- *tmp = 0;
-
- if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) {
- strcat(irq_fullname, irq_name);
- strcat(irq_fullname, " ");
- strcat(irq_fullname, savedptr);
- tmp = strchr(irq_fullname, '\n');
- if (tmp)
- *tmp = 0;
- } else {
- irq_fullname_valid = 0;
+ if (strlen(savedptr) > 0) {
+ if (strlen(irq_name) + strlen(savedptr) + 1 < PATH_MAX) {
+ strcat(irq_fullname, irq_name);
+ strcat(irq_fullname, " ");
+ strcat(irq_fullname, savedptr);
+ tmp = strchr(irq_fullname, '\n');
+ if (tmp)
+ *tmp = 0;
+ } else {
+ irq_fullname_valid = 0;
+ }
}
#endif
irq_mod = last_token;
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.8.0
Release: 1
Release: 2
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
@ -32,6 +32,7 @@ Patch9005: feature-add-new-irq-migrate-rule-to-avoid-high-cpu-i.patch
Patch9006: feature-enable-irqbalance-to-link-with-multiple-clie.patch
Patch9007: feature-add-ability-to-set-hintpolicy-during-runtime.patch
Patch9008: feature-encapsulate-and-compile-the-functions-in-irqbalance-ui.patch
Patch9009: bugfix-fix-opendir-fails-in-check_platform_device.patch
%description
Irqbalance is a daemon to help balance the cpu load generated by
@ -118,6 +119,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Tue Aug 24 2021 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-2
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:fix opendir fails in check_platform_device
* Sat Apr 17 2021 Liu Chao <liuchao173@huawei.com> - 3:1.8.0-1
- Type:enhanced
- ID:NA
@ -130,7 +137,7 @@ fi
- SUG:restart
- DESC:backport patches
* Tue May 2 2021 Liu Chao <liuchao173@huawei.com> - 3:1.7.0-4
* Tue Mar 2 2021 Liu Chao <liuchao173@huawei.com> - 3:1.7.0-4
- Type:enhanced
- ID:NA
- SUG:restart