libxl: fix libxl_get_cpu_topology
PATCH 1/1 libxl: fix libxl_get_cpu_topology
Fix upper bound of for loop, thus preventing memory corruption.
Signed-off-by Wei Liu <[email protected]>
--- tools/libxl/libxl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/libxl/libxl.c +1 -1
@@ -2872,7 +2872,7 @@ libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr) goto fail; } -for (i =0 ; i <= max_cpus; i++) { +for (i =0 ; i < max_cpus; i++) {#define V (map, i) (map[i] == INVALID_TOPOLOGY_ID) ? \ LIBXL_CPUTOPOLOGY_INVALID_ENTRY : map[i] ret[i].core =V (coremap, i);
Signature · 1 line
1.7.2.5
Quoted 3 lines · Wei Liu
Fix upper bound of for loop, thus preventing memory corruption.
Signed-off-by Wei Liu <[email protected]>
Acked-by Ian Campbell <[email protected]>
Quoted 17 lines
--- tools/libxl/libxl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)tools/libxl/libxl.c +1
-1@@ -2872,7 +2872,7 @@ libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nr) goto fail; } -for (i =0 ; i <= max_cpus; i++) { +for (i =0 ; i < max_cpus; i++) {#define V (map, i) (map[i] == INVALID_TOPOLOGY_ID) ? \ LIBXL_CPUTOPOLOGY_INVALID_ENTRY : map[i] ret[i].core =V (coremap, i);
Ian Jackson
Acked-byIan Campbell writes ("Re: [Xen-devel] [PATCH] libxl: fix libxl_get_cpu_topology"):
Quoted 5 lines · Wei Liu
Quoted 3 lines
Fix upper bound of for loop, thus preventing memory corruption.
Signed-off-by Wei Liu <[email protected]>Acked-by Ian Campbell <[email protected]>
Thanks.
Acked-by Ian Jackson <[email protected]>
Committed-by Ian Jackson <[email protected]>