Subject: Re: [PATCH 1/4] drivers/net/enic: decrement sizeof size in strncmp

From: Jörg-Volker Peetz <[email-masked]>
Date: Thu, 12 Nov 2009 11:05:54 +0100

Julia Lawall wrote:
<snip>
> strncmp(foo, abc, 
> - sizeof(abc)
> + sizeof(abc)-1
>  )
<snip>
> -	if (strncmp(fw_info->hw_version, "A1", sizeof("A1")) == 0)
> +	if (strncmp(fw_info->hw_version, "A1", sizeof("A1") - 1) == 0)
>  		*hw_ver = VNIC_DEV_HW_VER_A1;
> -	else if (strncmp(fw_info->hw_version, "A2", sizeof("A2")) == 0)
> +	else if (strncmp(fw_info->hw_version, "A2", sizeof("A2") - 1) == 0)
<snip>
Why not use strlen(abc) instead of sizeof(abc) - 1 ?
-- 
Regards,
Jörg-Volker.