Skip to content

Commit 30f5dfb

Browse files
committed
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 <[email protected]>
1 parent 8a1d24a commit 30f5dfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rproc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ static int rproc_init_by_modalias(void)
5555
if (modalias_fd < 0)
5656
goto close_rproc_fd;
5757

58-
ret = read(modalias_fd, modalias, sizeof(modalias));
58+
ret = read(modalias_fd, modalias, sizeof(modalias) - 1);
5959
if (ret < 0)
6060
goto close_modalias_fd;
61+
modalias[ret] = '\0';
6162

6263
if (!strstr(modalias, "-mpss-pas") && !strstr(modalias, "-mss-pil"))
6364
goto close_modalias_fd;

0 commit comments

Comments
 (0)