Skip to content

Commit e1c4128

Browse files
yosefekarasevb
authored andcommitted
pml/ucx: fix EOL symbol for driver path
Signed-off-by: Boris Karasev <karasev.b@gmail.com>
1 parent 070640e commit e1c4128

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
@@ -219,12 +219,12 @@ static bool opal_common_ucx_check_device(const char *device_name, char **device_
219219
"/sys/class/infiniband/%s/device/driver", ib_device_name);
220220
free(ib_device_name);
221221

222-
driver_path[sizeof(driver_path) - 1] = '\0';
223222
ret = readlink(sysfs_driver_link, driver_path, sizeof(driver_path) - 1);
224223
if (ret < 0) {
225224
MCA_COMMON_UCX_VERBOSE(2, "readlink(%s) failed: %s", sysfs_driver_link, strerror(errno));
226225
return false;
227226
}
227+
driver_path[ret] = '\0'; /* readlink does not append \0 */
228228

229229
driver_name = basename(driver_path);
230230
for (list_item = device_list; *list_item != NULL; ++list_item) {

0 commit comments

Comments
 (0)