ACK: [PATCH] lib: fwts_acpi_tables: fix warnings found by clang scan-build
ivanhu
ivan.hu at canonical.com
Thu Feb 18 06:56:48 UTC 2016
On 2016年02月17日 07:36, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> scan build detected the possibility of a zero sized read, causing ptr
> to be left NULL and/or size to be 0, so check for these and bail out
> with an error if this is detected.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/src/fwts_acpi_tables.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 59fd4ba..281ce77 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -757,6 +757,9 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length)
> size += n;
> }
>
> + if (!ptr || !size)
> + goto err_no_data;
> +
> /*
> * ..and copy table into a 32 bit memory space buffer
> */
> @@ -770,6 +773,7 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length)
>
> err:
> free(ptr);
> +err_no_data:
> *length = 0;
> return NULL;
> }
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list