diff mbox series

FWTS: FACS test: Add a check for empty BIOS memory map info list

Message ID 1523368474-31577-1-git-send-email-rsahu@apm.com
State Accepted
Headers show
Series FWTS: FACS test: Add a check for empty BIOS memory map info list | expand

Commit Message

Rameshwar Prasad Sahu April 10, 2018, 1:54 p.m. UTC
FWTS compliance test suit tries to gather the BIOS memory map list
info from the sysfs file called "/sys/firmware/memmap", in case of
failure it retry to get the same from the klog(kernel log). If it
fails here also then we should not check that allocated memory for
FACS structure is reserved or not, because we don't have memory map
info to compare.

This patch fixes this issue by adding a check for empty memory_map_list
before comparing.

Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
---
 src/lib/src/fwts_memorymap.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

--
1.7.1

Comments

Alex Hung April 11, 2018, 6:49 p.m. UTC | #1
On 2018-04-10 06:54 AM, Rameshwar Prasad Sahu wrote:
> FWTS compliance test suit tries to gather the BIOS memory map list
> info from the sysfs file called "/sys/firmware/memmap", in case of
> failure it retry to get the same from the klog(kernel log). If it
> fails here also then we should not check that allocated memory for
> FACS structure is reserved or not, because we don't have memory map
> info to compare.
> 
> This patch fixes this issue by adding a check for empty memory_map_list
> before comparing.
> 
> Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
> ---
>   src/lib/src/fwts_memorymap.c |    4 ++++
>   1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/src/lib/src/fwts_memorymap.c b/src/lib/src/fwts_memorymap.c
> index 099d0a9..26750bd 100644
> --- a/src/lib/src/fwts_memorymap.c
> +++ b/src/lib/src/fwts_memorymap.c
> @@ -153,6 +153,10 @@ fwts_bool fwts_memory_map_is_reserved(fwts_list *memory_map_list, const uint64_t
>   	if (memory_map_list == NULL)
>   		return FWTS_TRUE;
> 
> +	/* when we have FWTS_MEMORY_MAP info list empty, then assume all is fair */
> +	if (memory_map_list->len == 0)
> +		return FWTS_TRUE;
> +
>   	/* bios data area is always reserved */
>   	if ((memory >= 640 * 1024) && (memory <= 1024*1024))
>   		return FWTS_TRUE;
> --
> 1.7.1
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King April 12, 2018, 1:12 p.m. UTC | #2
On 10/04/18 14:54, Rameshwar Prasad Sahu wrote:
> FWTS compliance test suit tries to gather the BIOS memory map list
> info from the sysfs file called "/sys/firmware/memmap", in case of
> failure it retry to get the same from the klog(kernel log). If it
> fails here also then we should not check that allocated memory for
> FACS structure is reserved or not, because we don't have memory map
> info to compare.
> 
> This patch fixes this issue by adding a check for empty memory_map_list
> before comparing.
> 
> Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
> ---
>  src/lib/src/fwts_memorymap.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/src/lib/src/fwts_memorymap.c b/src/lib/src/fwts_memorymap.c
> index 099d0a9..26750bd 100644
> --- a/src/lib/src/fwts_memorymap.c
> +++ b/src/lib/src/fwts_memorymap.c
> @@ -153,6 +153,10 @@ fwts_bool fwts_memory_map_is_reserved(fwts_list *memory_map_list, const uint64_t
>  	if (memory_map_list == NULL)
>  		return FWTS_TRUE;
> 
> +	/* when we have FWTS_MEMORY_MAP info list empty, then assume all is fair */
> +	if (memory_map_list->len == 0)
> +		return FWTS_TRUE;
> +
>  	/* bios data area is always reserved */
>  	if ((memory >= 640 * 1024) && (memory <= 1024*1024))
>  		return FWTS_TRUE;
> --
> 1.7.1
> 
Good idea.  Thanks!

Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_memorymap.c b/src/lib/src/fwts_memorymap.c
index 099d0a9..26750bd 100644
--- a/src/lib/src/fwts_memorymap.c
+++ b/src/lib/src/fwts_memorymap.c
@@ -153,6 +153,10 @@  fwts_bool fwts_memory_map_is_reserved(fwts_list *memory_map_list, const uint64_t
 	if (memory_map_list == NULL)
 		return FWTS_TRUE;

+	/* when we have FWTS_MEMORY_MAP info list empty, then assume all is fair */
+	if (memory_map_list->len == 0)
+		return FWTS_TRUE;
+
 	/* bios data area is always reserved */
 	if ((memory >= 640 * 1024) && (memory <= 1024*1024))
 		return FWTS_TRUE;