Skip to content

Commit

Permalink
UCS/GTEST: fixed uninitialized value access
Browse files Browse the repository at this point in the history
  • Loading branch information
iyastreb committed May 30, 2024
1 parent bb67c18 commit 6070dd4
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/ucs/memory/rcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,7 @@ ucs_rcache_check_overlap_one(ucs_rcache_t *rcache, ucs_pgt_addr_t *start,
return UCS_OK;
}

/* Lock must be held
* Old ASAN versions reports buffer underflow false-positive during access to
* `region` through `ucs_list_link_t` entry. Newer ASAN versions don't
* report this issue (e.g. standard ASAN on Ubuntu 22.04).
*/
/* Lock must be held */
static ucs_status_t UCS_F_NO_SANITIZE_ADDRESS
ucs_rcache_check_overlap(ucs_rcache_t *rcache, void *arg, ucs_pgt_addr_t *start,
ucs_pgt_addr_t *end, size_t *alignment, int *prot,
Expand All @@ -855,14 +851,16 @@ ucs_rcache_check_overlap(ucs_rcache_t *rcache, void *arg, ucs_pgt_addr_t *start,
ucs_list_head_init(&region_list);
ucs_rcache_find_regions(rcache, *start, *end - 1, &region_list);

region = ucs_list_next(&region_list, ucs_rcache_region_t, tmp_list);
if (ucs_list_is_only(&region_list, &region->tmp_list) &&
(*start >= region->super.start) && (*end <= region->super.end) &&
ucs_rcache_region_test(region, *prot, *alignment)) {
/* Found a region which contains the given address range */
ucs_rcache_region_hold(rcache, region);
*region_p = region;
return UCS_ERR_ALREADY_EXISTS;
if (!ucs_list_is_empty(&region_list)) {
region = ucs_list_next(&region_list, ucs_rcache_region_t, tmp_list);
if (ucs_list_is_only(&region_list, &region->tmp_list) &&
(*start >= region->super.start) && (*end <= region->super.end) &&
ucs_rcache_region_test(region, *prot, *alignment)) {
/* Found a region which contains the given address range */
ucs_rcache_region_hold(rcache, region);
*region_p = region;
return UCS_ERR_ALREADY_EXISTS;
}
}

/* TODO check if any of the regions is locked */
Expand Down

0 comments on commit 6070dd4

Please sign in to comment.