Fix buffer overflow when parsing kernel cmdline (#1133)

[ROCm/rccl commit: 137571fa01]
Этот коммит содержится в:
Wenkai Du
2024-04-08 11:12:20 -07:00
коммит произвёл GitHub
родитель 62b9f0d3a7
Коммит 0941d6bc6e
+2 -2
Просмотреть файл
@@ -109,7 +109,7 @@ static ncclResult_t ncclInit() {
NCCLCHECK(bootstrapNetInit());
NCCLCHECK(ncclNetPluginInit());
char strValue[1024];
char strValue[2048];
NCCLCHECK(ncclTopoGetStrFromSys("/proc/sys/kernel", "numa_balancing", strValue));
if (strcmp(strValue, "1") == 0)
WARN("NUMA auto balancing enabled which can lead to variability in the RCCL performance! Disable by \"sudo sysctl kernel.numa_balancing=0\"");
@@ -127,7 +127,7 @@ static ncclResult_t ncclInit() {
FILE* file;
if ((file = fopen("/proc/cmdline", "r")) != NULL) {
if (feof(file) == 0 && ferror(file) == 0) {
int len = fread(strValue, 1, 1024, file);
int len = fread(strValue, 1, 2047, file);
strValue[len] = '\0';
}
fclose(file);