diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
commit | 8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch) | |
tree | 1fdda006866bca20d41cb206767ea5241e36852f /sys-utils/lscpu-topology.c | |
parent | Adding debian version 2.39.3-11. (diff) | |
download | util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip |
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sys-utils/lscpu-topology.c')
-rw-r--r-- | sys-utils/lscpu-topology.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys-utils/lscpu-topology.c b/sys-utils/lscpu-topology.c index 754b3fc..e3742e3 100644 --- a/sys-utils/lscpu-topology.c +++ b/sys-utils/lscpu-topology.c @@ -1,3 +1,14 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Copyright (C) 2008 Cai Qian <qcai@redhat.com> + * Copyright (C) 2008-2023 Karel Zak <kzak@redhat.com> + */ #include <errno.h> #include <stdlib.h> #include <sys/types.h> @@ -242,7 +253,8 @@ struct lscpu_cache *lscpu_cpu_get_cache(struct lscpu_cxt *cxt, for (i = 0; i < cxt->ncaches; i++) { struct lscpu_cache *ca = &cxt->caches[i]; - if (strcmp(ca->name, name) == 0 && + if (ca->sharedmap && + strcmp(ca->name, name) == 0 && CPU_ISSET_S(cpu->logical_id, cxt->setsize, ca->sharedmap)) return ca; } @@ -274,8 +286,8 @@ static struct lscpu_cache *add_cache(struct lscpu_cxt *cxt, struct lscpu_cache *ca; cxt->ncaches++; - cxt->caches = xrealloc(cxt->caches, - cxt->ncaches * sizeof(*cxt->caches)); + cxt->caches = xreallocarray(cxt->caches, + cxt->ncaches, sizeof(*cxt->caches)); ca = &cxt->caches[cxt->ncaches - 1]; memset(ca, 0 , sizeof(*ca)); |