ACK: [PATCH] uefirtvariable: fix the wrong operator used, coverity scan error (LP: #1362893)
Alex Hung
alex.hung at canonical.com
Fri Aug 29 06:29:18 UTC 2014
On 08/29/2014 10:47 AM, Ivan Hu wrote:
> CID 1232806, CID1232805: Wrong operator used (CONSTANT_EXPRESSION_RESULT)
> always true regardless of the values of its operand.
>
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
> src/uefi/uefirtvariable/uefirtvariable.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index 46c7f0e..f0fd0ce 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -781,9 +781,9 @@ static int setvariable_insertvariable(
>
> if (ioret == -1) {
> if ((status == EFI_INVALID_PARAMETER) &&
> - ((attributes | FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) ||
> - (attributes | FWTS_UEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) ||
> - (attributes | FWTS_UEFI_VARIABLE_APPEND_WRITE))) {
> + ((attributes & FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) ||
> + (attributes & FWTS_UEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) ||
> + (attributes & FWTS_UEFI_VARIABLE_APPEND_WRITE))) {
> fwts_uefi_print_status_info(fw, status);
> fwts_skipped(fw,
> "EFI_INVALID_PARAMETER shall be returned, "
> @@ -941,8 +941,8 @@ static int setvariable_invalidattr(
> ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
>
> if ((status == EFI_SUCCESS) && (ioret != -1)) {
> - if ((attributes | FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) &&
> - (attributes | FWTS_UEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) &&
> + if ((attributes & FWTS_UEFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) &&
> + (attributes & FWTS_UEFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) &&
> (status != EFI_INVALID_PARAMETER)) {
> fwts_warning(fw,
> "Both the EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS attribute and the "
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list