about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-07-16 12:29:14 -0400
committerRich Felker <dalias@aerifal.cx>2018-07-16 12:29:14 -0400
commit5fdccbcd8f080ca6cd2c64cca520805f17af857b (patch)
tree70ea44fc1cb8c75754872c62025071b821346791
parent187bcc3bf40bf187c5d76d206b04028fa8ca403b (diff)
downloadmusl-5fdccbcd8f080ca6cd2c64cca520805f17af857b.tar.gz
musl-5fdccbcd8f080ca6cd2c64cca520805f17af857b.tar.xz
musl-5fdccbcd8f080ca6cd2c64cca520805f17af857b.zip
fix inefficient choice of tlsdesc function due to off-by-one
tls_id is one-based, whereas [static_]tls_cnt is a count, so
comparison for checking that a given tls_id is dynamic rather than
static needs to use strict inequality.
-rw-r--r--ldso/dynlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 41534e90..8242a1d1 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -438,7 +438,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri
 #endif
 		case REL_TLSDESC:
 			if (stride<3) addend = reloc_addr[1];
-			if (runtime && def.dso->tls_id >= static_tls_cnt) {
+			if (runtime && def.dso->tls_id > static_tls_cnt) {
 				struct td_index *new = malloc(sizeof *new);
 				if (!new) {
 					error(