19
19
* Copyright (C) 2018 Mellanox Technologies, Ltd.
20
20
* All rights reserved.
21
21
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
22
+ * Copyright (c) 2019 IBM Corporation. All rights reserved.
22
23
* $COPYRIGHT$
23
24
*
24
25
* Additional copyrights may follow
@@ -1728,14 +1729,14 @@ int opal_hwloc_base_cset2str(char *str, int len,
1728
1729
for (core_index = 0 ; core_index < num_cores ; ++ core_index ) {
1729
1730
if (map [socket_index ][core_index ] > 0 ) {
1730
1731
if (!first ) {
1731
- strncat (str , ", " , len - strlen (str ));
1732
+ strncat (str , ", " , len - strlen (str ) - 1 );
1732
1733
}
1733
1734
first = false;
1734
1735
1735
1736
snprintf (tmp , stmp , "socket %d[core %d[hwt %s]]" ,
1736
1737
socket_index , core_index ,
1737
1738
bitmap2rangestr (map [socket_index ][core_index ]));
1738
- strncat (str , tmp , len - strlen (str ));
1739
+ strncat (str , tmp , len - strlen (str ) - 1 );
1739
1740
}
1740
1741
}
1741
1742
}
@@ -1791,7 +1792,7 @@ int opal_hwloc_base_cset2mapstr(char *str, int len,
1791
1792
for (socket = hwloc_get_obj_by_type (topo , HWLOC_OBJ_SOCKET , 0 );
1792
1793
NULL != socket ;
1793
1794
socket = socket -> next_cousin ) {
1794
- strncat (str , "[" , len - strlen (str ));
1795
+ strncat (str , "[" , len - strlen (str ) - 1 );
1795
1796
1796
1797
/* Iterate over all existing cores in this socket */
1797
1798
core_index = 0 ;
@@ -1803,7 +1804,7 @@ int opal_hwloc_base_cset2mapstr(char *str, int len,
1803
1804
socket -> cpuset ,
1804
1805
HWLOC_OBJ_CORE , ++ core_index )) {
1805
1806
if (core_index > 0 ) {
1806
- strncat (str , "/" , len - strlen (str ));
1807
+ strncat (str , "/" , len - strlen (str ) - 1 );
1807
1808
}
1808
1809
1809
1810
/* Iterate over all existing PUs in this core */
@@ -1818,13 +1819,13 @@ int opal_hwloc_base_cset2mapstr(char *str, int len,
1818
1819
1819
1820
/* Is this PU in the cpuset? */
1820
1821
if (hwloc_bitmap_isset (cpuset , pu -> os_index )) {
1821
- strncat (str , "B" , len - strlen (str ));
1822
+ strncat (str , "B" , len - strlen (str ) - 1 );
1822
1823
} else {
1823
- strncat (str , "." , len - strlen (str ));
1824
+ strncat (str , "." , len - strlen (str ) - 1 );
1824
1825
}
1825
1826
}
1826
1827
}
1827
- strncat (str , "]" , len - strlen (str ));
1828
+ strncat (str , "]" , len - strlen (str ) - 1 );
1828
1829
}
1829
1830
1830
1831
return OPAL_SUCCESS ;
0 commit comments