[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AFBDE02.20806@web.de>
Date: Thu, 12 Nov 2009 11:05:54 +0100
From: Jörg-Volker Peetz <jvpeetz@....de>
To: linux-kernel@...r.kernel.org
Cc: netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/4] drivers/net/enic: decrement sizeof size in strncmp
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists