irqbalance: Add return value check of opendir in do_one_cpu

Add return value check of opendir in do_one_cpu

Signed-off-by: qinyu <qinyu32@huawei.com>
This commit is contained in:
qinyu 2023-01-05 15:17:29 +08:00
parent 94fb3fd6d8
commit 3d6bfed55b
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 47f0f26d415b8a1fb2e1d04a39f27b1e4843e7b6 Mon Sep 17 00:00:00 2001
From: hejingxian 00273181 <hejingxian@huawei.com>
Date: Fri, 9 Apr 2021 13:32:08 +0800
Subject: [PATCH] Add return value check of opendir in do_one_cpu
Reference:https://github.com/Irqbalance/irqbalance/commit/47f0f26d415b8a1fb2e1d04a39f27b1e4843e7b6
Conflict:NA
---
cputree.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/cputree.c b/cputree.c
index a8dba73..e4695f2 100644
--- a/cputree.c
+++ b/cputree.c
@@ -366,7 +366,7 @@ static void do_one_cpu(char *path)
struct topo_obj *node;
dir = opendir(path);
- do {
+ while (dir) {
entry = readdir(dir);
if (!entry)
break;
@@ -379,8 +379,9 @@ static void do_one_cpu(char *path)
break;
}
}
- } while (entry);
- closedir(dir);
+ }
+ if (dir)
+ closedir(dir);
/*
* In case of multiple NUMA nodes within a CPU package,
--
2.23.0

View File

@ -1,7 +1,7 @@
Summary: A dynamic adaptive IRQ balancing daemon
Name: irqbalance
Version: 1.7.0
Release: 10
Release: 11
Epoch: 3
License: GPLv2
Source0: https://github.com/Irqbalance/irqbalance/archive/irqbalance-%{version}.tar.gz
@ -29,6 +29,7 @@ Patch6004: backport-Add-log-for-hotplug-appropriately.patch
Patch6005: backport-Add-hot-pull-method-for-irqbalance.patch
Patch6006: backport-Also-fetch-node-info-for-non-PCI-devices.patch
Patch6007: backport-Hotplug-may-occur-again-during-sleep-so-wait-until-t.patch
Patch6008: backport-Add-return-value-check-of-opendir-in-do_one_cpu.patch
%description
Irqbalance is a daemon to help balance the cpu load generated by
@ -86,6 +87,12 @@ fi
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
%changelog
* Thu Jan 5 2023 qinyu <qinyu32@huawei.com> - 3:1.7.0-11
- Type:bugfix
- ID:NA
- SUG:restart
- DESC: Add return value check of opendir in do_one_cpu
* Thu Jan 5 2023 qinyu <qinyu32@huawei.com> - 3:1.7.0-10
- Type:bugfix
- ID:NA