ACK: [PATCH] lib: fwts_coreboot_cbmem: fix cbmem_console_addr check

Alex Hung alex.hung at canonical.com
Tue Aug 14 19:14:21 UTC 2018


On 2018-08-14 06:22 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> The check to see if parse_cbmem_ref returned non-zero should
> be checking the contents of cbmem_console_addr and not
> the pointer cbmem_console_addr. Add the missing *.
> 
> Detected by CoverityScan, CID#1394471 ("Dereference before null check")
> 
> Fixes: c9bf07f25d13 ("fwts_coreboot.c: add cbmem console parser")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/lib/src/fwts_coreboot_cbmem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_coreboot_cbmem.c b/src/lib/src/fwts_coreboot_cbmem.c
> index 52f83f47..4185338d 100644
> --- a/src/lib/src/fwts_coreboot_cbmem.c
> +++ b/src/lib/src/fwts_coreboot_cbmem.c
> @@ -152,7 +152,7 @@ static int parse_cbtable_entries(
>   		switch (lbr_p->tag) {
>   		case LB_TAG_CBMEM_CONSOLE: {
>   			*cbmem_console_addr = (off_t)parse_cbmem_ref((struct lb_cbmem_ref *) lbr_p).cbmem_addr;
> -			if (cbmem_console_addr)
> +			if (*cbmem_console_addr)
>   				return 0;
>   			continue;
>   		}
> 

Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list