[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/30] target/ppc/kvm: Skip current and parent directories in kvmp
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 07/30] target/ppc/kvm: Skip current and parent directories in kvmppc_find_cpu_dt |
Date: |
Mon, 18 Jul 2022 14:21:45 -0300 |
From: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
Some systems have /proc/device-tree/cpus/../clock-frequency. However,
this is not the expected path for a CPU device tree directory.
Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.ibm.com>
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220712210810.35514-1-muriloo@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/kvm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 6eed466f80..466d0d2f4c 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1877,6 +1877,12 @@ static int kvmppc_find_cpu_dt(char *buf, int buf_len)
buf[0] = '\0';
while ((dirp = readdir(dp)) != NULL) {
FILE *f;
+
+ /* Don't accidentally read from the current and parent directories */
+ if (strcmp(dirp->d_name, ".") == 0 || strcmp(dirp->d_name, "..") == 0)
{
+ continue;
+ }
+
snprintf(buf, buf_len, "%s%s/clock-frequency", PROC_DEVTREE_CPU,
dirp->d_name);
f = fopen(buf, "r");
--
2.36.1
- [PULL 00/30] ppc queue, Daniel Henrique Barboza, 2022/07/18
- [PULL 01/30] ppc64: Allocate IRQ lines with qdev_init_gpio_in(), Daniel Henrique Barboza, 2022/07/18
- [PULL 02/30] ppc/40x: Allocate IRQ lines with qdev_init_gpio_in(), Daniel Henrique Barboza, 2022/07/18
- [PULL 03/30] ppc/6xx: Allocate IRQ lines with qdev_init_gpio_in(), Daniel Henrique Barboza, 2022/07/18
- [PULL 04/30] ppc/e500: Allocate IRQ lines with qdev_init_gpio_in(), Daniel Henrique Barboza, 2022/07/18
- [PULL 05/30] ppc: Remove unused irq_inputs, Daniel Henrique Barboza, 2022/07/18
- [PULL 06/30] hw/ppc: pass random seed to fdt, Daniel Henrique Barboza, 2022/07/18
- [PULL 07/30] target/ppc/kvm: Skip current and parent directories in kvmppc_find_cpu_dt,
Daniel Henrique Barboza <=
- [PULL 08/30] target/ppc: Fix gen_priv_exception error value in mfspr/mtspr, Daniel Henrique Barboza, 2022/07/18
- [PULL 11/30] target/ppc: fix exception error code in helper_{load, store}_dcr, Daniel Henrique Barboza, 2022/07/18
- [PULL 09/30] target/ppc: fix exception error value in slbfee, Daniel Henrique Barboza, 2022/07/18
- [PULL 13/30] target/ppc: fix exception error code in spr_write_excp_vector, Daniel Henrique Barboza, 2022/07/18
- [PULL 12/30] target/ppc: fix PMU Group A register read/write exceptions, Daniel Henrique Barboza, 2022/07/18
- [PULL 10/30] target/ppc: remove mfdcrux and mtdcrux, Daniel Henrique Barboza, 2022/07/18
- [PULL 16/30] target/ppc: receive DisasContext explicitly in GEN_PRIV, Daniel Henrique Barboza, 2022/07/18
- [PULL 14/30] target/ppc: Move tlbie[l] to decode tree, Daniel Henrique Barboza, 2022/07/18
- [PULL 15/30] target/ppc: Implement ISA 3.00 tlbie[l], Daniel Henrique Barboza, 2022/07/18
- [PULL 19/30] target/ppc: Move slbieg to decodetree, Daniel Henrique Barboza, 2022/07/18