summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2018-08-02 09:02:47 +0200
committerAndy Polyakov <appro@openssl.org>2018-08-03 09:01:08 +0200
commitc700d1fe090acf3661d3948c25f489803f50a98b (patch)
tree0a141bbedb72a535caa0fd3390f5b17e79438336
parent4e7ade969944a9e6923a48471efb910dfb5f4a3a (diff)
asn1/tasn_utl.c: fix logical error in asn1_do_lock.
CRYPTO_atomic_add was assumed to return negative value on error, while it returns 0. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/6843)
-rw-r--r--crypto/asn1/tasn_utl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c
index f79d7d6b44..cad45a07f5 100644
--- a/crypto/asn1/tasn_utl.c
+++ b/crypto/asn1/tasn_utl.c
@@ -76,7 +76,7 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it)
}
return 1;
}
- if (CRYPTO_atomic_add(lck, op, &ret, *lock) < 0)
+ if (!CRYPTO_atomic_add(lck, op, &ret, *lock))
return -1; /* failed */
#ifdef REF_PRINT
fprintf(stderr, "%p:%4d:%s\n", it, *lck, it->sname);