diff mbox

uefi: uefirtvariable: print out the duplicate variable name (LP: #1340492)

Message ID 1405048839-5013-1-git-send-email-ivan.hu@canonical.com
State Accepted
Headers show

Commit Message

Ivan Hu July 11, 2014, 3:20 a.m. UTC
When fwts tests find out a duplicate name exist, print out the duplicate
variable name.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/uefi/uefirtvariable/uefirtvariable.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Colin Ian King July 11, 2014, 7:33 a.m. UTC | #1
On 11/07/14 04:20, Ivan Hu wrote:
> When fwts tests find out a duplicate name exist, print out the duplicate
> variable name.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 7ddfeb1..fd2dc7e 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -565,6 +565,7 @@ static int getnextvariable_test3(fwts_framework *fw)
>  	uint64_t variablenamesize = MAX_DATA_LENGTH;
>  	uint16_t variablename[MAX_DATA_LENGTH];
>  	EFI_GUID vendorguid;
> +	char name[MAX_DATA_LENGTH];
>  
>  	getnextvariablename.VariableNameSize = &variablenamesize;
>  	getnextvariablename.VariableName = variablename;
> @@ -632,9 +633,10 @@ static int getnextvariable_test3(fwts_framework *fw)
>  		item->hash = hash_func(variablename, variablenamesize);
>  
>  		if (bucket_insert(item)) {
> +			fwts_uefi_str16_to_str(name, sizeof(name), variablename);
>  			fwts_failed(fw, LOG_LEVEL_HIGH,
>  				"UEFIRuntimeGetNextVariableName",
> -				"Duplicate variable name found.");
> +				"Duplicate variable name %s found.", name);
>  			free(item->name);
>  			free(item->guid);
>  			free(item);
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung July 11, 2014, 7:51 a.m. UTC | #2
On 07/11/2014 11:20 AM, Ivan Hu wrote:
> When fwts tests find out a duplicate name exist, print out the duplicate
> variable name.
>
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 7ddfeb1..fd2dc7e 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -565,6 +565,7 @@ static int getnextvariable_test3(fwts_framework *fw)
>   	uint64_t variablenamesize = MAX_DATA_LENGTH;
>   	uint16_t variablename[MAX_DATA_LENGTH];
>   	EFI_GUID vendorguid;
> +	char name[MAX_DATA_LENGTH];
>
>   	getnextvariablename.VariableNameSize = &variablenamesize;
>   	getnextvariablename.VariableName = variablename;
> @@ -632,9 +633,10 @@ static int getnextvariable_test3(fwts_framework *fw)
>   		item->hash = hash_func(variablename, variablenamesize);
>
>   		if (bucket_insert(item)) {
> +			fwts_uefi_str16_to_str(name, sizeof(name), variablename);
>   			fwts_failed(fw, LOG_LEVEL_HIGH,
>   				"UEFIRuntimeGetNextVariableName",
> -				"Duplicate variable name found.");
> +				"Duplicate variable name %s found.", name);
>   			free(item->name);
>   			free(item->guid);
>   			free(item);
>

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 7ddfeb1..fd2dc7e 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -565,6 +565,7 @@  static int getnextvariable_test3(fwts_framework *fw)
 	uint64_t variablenamesize = MAX_DATA_LENGTH;
 	uint16_t variablename[MAX_DATA_LENGTH];
 	EFI_GUID vendorguid;
+	char name[MAX_DATA_LENGTH];
 
 	getnextvariablename.VariableNameSize = &variablenamesize;
 	getnextvariablename.VariableName = variablename;
@@ -632,9 +633,10 @@  static int getnextvariable_test3(fwts_framework *fw)
 		item->hash = hash_func(variablename, variablenamesize);
 
 		if (bucket_insert(item)) {
+			fwts_uefi_str16_to_str(name, sizeof(name), variablename);
 			fwts_failed(fw, LOG_LEVEL_HIGH,
 				"UEFIRuntimeGetNextVariableName",
-				"Duplicate variable name found.");
+				"Duplicate variable name %s found.", name);
 			free(item->name);
 			free(item->guid);
 			free(item);