Skip to content

Commit

Permalink
bitmap: handle failure to extend bitmap in list_sscanf()
Browse files Browse the repository at this point in the history
Thanks to Jonathan Peyton for the patch, found by klocwork.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Dec 6, 2019
1 parent 91701af commit 9294f5d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hwloc/bitmap.c
Expand Up @@ -505,14 +505,16 @@ int hwloc_bitmap_list_sscanf(struct hwloc_bitmap_s *set, const char * __hwloc_re

if (begin != -1) {
/* finishing a range */
hwloc_bitmap_set_range(set, begin, val);
if (hwloc_bitmap_set_range(set, begin, val) < 0)
goto failed;
begin = -1;

} else if (*next == '-') {
/* starting a new range */
if (*(next+1) == '\0') {
/* infinite range */
hwloc_bitmap_set_range(set, val, -1);
if (hwloc_bitmap_set_range(set, val, -1) < 0)
goto failed;
break;
} else {
/* normal range */
Expand Down

0 comments on commit 9294f5d

Please sign in to comment.