[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1383095144.12439.41.camel@joe-AO722>
Date: Tue, 29 Oct 2013 18:05:44 -0700
From: Joe Perches <joe@...ches.com>
To: Peter Huewe <peterhuewe@....de>
Cc: Ashley Lai <ashley@...leylai.com>, Rajiv Andrade <mail@...jiv.net>,
Marcel Selhorst <tpmdd@...horst.net>,
tpmdd-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
Xiaoyan Zhang <xiaoyan.zhang@...el.com>,
Gang Wei <gang.wei@...el.com>, stable@...r.kernel.org
Subject: Re: [PATCH 1/2] tpm/tpm_ppi: Do not compare strcmp(a,b) == -1
On Wed, 2013-10-30 at 01:40 +0100, Peter Huewe wrote:
> strcmp does return the difference between two strings not only -1,0,1
> consequently
> if (strcmp (a,b) == -1)
> might lead to taking the wrong branch
>
> -> compare with <= instead.
lib/string.c:strcmp returns only -1,0,1
so that's what the arch versions should do too.
However, arch implementations do vary...
fyi: using
if (strcmp(foo, bar) < 0)
is canonical.
There are no existing <= -1 uses.
--
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