Skip to content

Commit 747b04c

Browse files
authored
Merge pull request #9506 from karasevb/topic/v5.0.x/pml_ucx_driver_path
v5.0.x: pml/ucx: fix EOL symbol for driver path
2 parents be5b6a8 + dbaf15d commit 747b04c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opal/mca/common/ucx/common_ucx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ static bool opal_common_ucx_check_device(const char *device_name, char **device_
216216
"/sys/class/infiniband/%s/device/driver", ib_device_name);
217217
free(ib_device_name);
218218

219-
driver_path[sizeof(driver_path) - 1] = '\0';
220219
ret = readlink(sysfs_driver_link, driver_path, sizeof(driver_path) - 1);
221220
if (ret < 0) {
222221
MCA_COMMON_UCX_VERBOSE(2, "readlink(%s) failed: %s", sysfs_driver_link, strerror(errno));
223222
return false;
224223
}
224+
driver_path[ret] = '\0'; /* readlink does not append \0 */
225225

226226
driver_name = basename(driver_path);
227227
for (list_item = device_list; *list_item != NULL; ++list_item) {

0 commit comments

Comments
 (0)