ACK: [PATCH 4/8] acpi: pcc: add safe memory read check on mmap'd PCC header

ivanhu ivan.hu at canonical.com
Mon Jul 17 09:48:27 UTC 2017



On 07/14/2017 05:52 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Ensure we can read the mmap'd memory.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/acpi/pcc/pcc.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/src/acpi/pcc/pcc.c b/src/acpi/pcc/pcc.c
> index fff406aa..6b2f37af 100644
> --- a/src/acpi/pcc/pcc.c
> +++ b/src/acpi/pcc/pcc.c
> @@ -115,6 +115,13 @@ static void pcc_check_pcc_header(
>   			"..0x%" PRIx64 ".", addr, addr + length);
>   		return;
>   	}
> +	/* Ensure header can be read */
> +	if (fwts_safe_memread(hdr, length) != FWTS_OK) {
> +		fwts_log_info(fw, "Cannot read PCC header 0x%" PRIx64
> +			 "..0x%" PRIx64 ".", addr, addr + length);
> +		fwts_munmap(hdr, (size_t)length);
> +		return;
> +	}
>   
>   	fwts_log_info_verbatim(fw, "PCC header at 0x%" PRIx64 ".", addr);
>   	fwts_log_info_verbatim(fw, "  Signature:          0x%" PRIx32, hdr->signature);
> 

Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list