ACK: [PATCH] uefirtvariable: fix the unchecked return value

Alex Hung alex.hung at canonical.com
Thu May 9 03:51:17 UTC 2013


On 05/08/2013 11:06 AM, Ivan Hu wrote:
> Coverity CID #997310: Unchecked return value
>
> Need to check the return value for calling function "ioctl".
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>   src/uefi/uefirtvariable/uefirtvariable.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 16cd240..7c2fc1f 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -858,6 +858,7 @@ static int setvariable_invalidattr(
>   	EFI_GUID *gtestguid,
>   	const uint8_t datadiff)
>   {
> +	long ioret;
>   	struct efi_setvariable setvariable;
>   	uint64_t status;
>   	uint64_t dataindex;
> @@ -873,9 +874,9 @@ static int setvariable_invalidattr(
>   	setvariable.Data = data;
>   	setvariable.status = &status;
>
> -	ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
> +	ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
>
> -	if (status == EFI_SUCCESS) {
> +	if ((status == EFI_SUCCESS) && (ioret != -1)) {
>   		fwts_warning(fw,
>   			"After ExitBootServices() is performed, the "
>   			"attributes %" PRIu32 ", "
>
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list