lkml.org 
[lkml]   [2009]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/4] drivers/net/enic: decrement sizeof size in strncmp
Date
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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-12 11:11    [W:0.031 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site