mirror of
https://github.com/linux-msm/rmtfs.git
synced 2025-12-24 14:06:25 +01:00
rproc: NUL-terminate the modalias
According to valgrind the modalias read from the remoteproc device is not NUL-terminated, so do this to avoid reading in the weeds. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
3
rproc.c
3
rproc.c
@@ -55,9 +55,10 @@ static int rproc_init_by_modalias(void)
|
||||
if (modalias_fd < 0)
|
||||
goto close_rproc_fd;
|
||||
|
||||
ret = read(modalias_fd, modalias, sizeof(modalias));
|
||||
ret = read(modalias_fd, modalias, sizeof(modalias) - 1);
|
||||
if (ret < 0)
|
||||
goto close_modalias_fd;
|
||||
modalias[ret] = '\0';
|
||||
|
||||
if (!strstr(modalias, "-mpss-pas") && !strstr(modalias, "-mss-pil"))
|
||||
goto close_modalias_fd;
|
||||
|
||||
Reference in New Issue
Block a user