ACK: [PATCH] acpi: uniqueid: clean up pedantic static analysis warnings

Alex Hung alex.hung at canonical.com
Sat Dec 4 02:03:27 UTC 2021


On 2021-11-30 1:20 a.m., Ivan Hu wrote:
> Clean up static analysis warning of dereference before null check
> (REVERSE_INULL).
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/acpi/uniqueid/uniqueid.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/acpi/uniqueid/uniqueid.c b/src/acpi/uniqueid/uniqueid.c
> index f745dfe5..7d150015 100644
> --- a/src/acpi/uniqueid/uniqueid.c
> +++ b/src/acpi/uniqueid/uniqueid.c
> @@ -108,11 +108,11 @@ static bool is_uniqueid_equal(acpi_ids *obj1, acpi_ids *obj2)
>  {
>  	bool hid_match = false;
>  
> -	/* _HID and _CID are in the same device */
> -	if (!strncmp(obj1->hid_name, obj2->hid_name, strlen(obj1->hid_name) - 4))
> +	if (obj1 == NULL || obj2 == NULL)
>  		return false;
>  
> -	if (obj1 == NULL || obj2 == NULL)
> +	/* _HID and _CID are in the same device */
> +	if (!strncmp(obj1->hid_name, obj2->hid_name, strlen(obj1->hid_name) - 4))
>  		return false;
>  
>  	if ((obj1->hid_obj->Type != obj2->hid_obj->Type) || (obj1->uid_obj->Type != obj2->uid_obj->Type))
> 


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



More information about the fwts-devel mailing list