[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 09/21] linux-user: Add gen-vdso tool
From: |
Peter Maydell |
Subject: |
Re: [PULL 09/21] linux-user: Add gen-vdso tool |
Date: |
Thu, 2 Nov 2023 12:49:07 +0000 |
On Mon, 30 Oct 2023 at 21:19, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> This tool will be used for post-processing the linked vdso image,
> turning it into something that is easy to include into elfload.c.
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Hi; Coverity complains about the lack of error-checking
here (CID 1523742):
> + /*
> + * Read the input file into a buffer.
> + * We expect the vdso to be small, on the order of one page,
> + * therefore we do not expect a partial read.
> + */
> + fseek(inf, 0, SEEK_END);
> + total_len = ftell(inf);
> + fseek(inf, 0, SEEK_SET);
> +
> + buf = malloc(total_len);
We don't check for errors from fseek() or ftell(). In particular
this means that if ftell() returned -1 we pass -1 to malloc(),
which isn't valid.
> + if (buf == NULL) {
> + goto perror_inf;
> + }
This could all be sidestepped by using glib, which would give
us the higher level g_file_get_contents(), rather than spending
20 lines doing it with POSIX APIs.
thanks
-- PMM
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PULL 09/21] linux-user: Add gen-vdso tool,
Peter Maydell <=