diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2020-12-07 08:17:04 -0800 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2020-12-07 08:17:04 -0800 |
commit | 30f5dfb8903d7e8da1d79cb5106089c09de01ff7 (patch) | |
tree | 2823b360b3a5a8dd262cd2f41208236c8dcf991e | |
parent | 8a1d24a704853bbb211aec62905191dac8411074 (diff) |
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>
-rw-r--r-- | rproc.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |