From: Nicholas Nethercote Date: Thu, 28 Oct 2004 16:53:51 +0000 (+0000) Subject: Fix off-by-one error with VKI_GDT_TLS_MAX. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dae1e8cd27ecf42459a84a3b43c4fa9b788ab927;p=thirdparty%2Fvalgrind.git Fix off-by-one error with VKI_GDT_TLS_MAX. git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@2872 --- diff --git a/coregrind/vg_ldt.c b/coregrind/vg_ldt.c index ba9b245bfe..a22a8e026a 100644 --- a/coregrind/vg_ldt.c +++ b/coregrind/vg_ldt.c @@ -196,7 +196,7 @@ Addr VG_(do_useseg) ( UInt seg_selector, Addr virtual_addr ) if (table == 0) { VgLdtEntry* the_tls; - vg_assert(seg_selector >= VKI_GDT_TLS_MIN && seg_selector < VKI_GDT_TLS_MAX); + vg_assert(seg_selector >= VKI_GDT_TLS_MIN && seg_selector <= VKI_GDT_TLS_MAX); /* Come up with a suitable GDT entry. We look at the thread's TLS array, which is pointed to by a VG_(baseBlock) entry. */ diff --git a/include/vg_kerneliface.h b/include/vg_kerneliface.h index 7dc4825302..04e42c09d3 100644 --- a/include/vg_kerneliface.h +++ b/include/vg_kerneliface.h @@ -665,7 +665,7 @@ typedef struct vki_modify_ldt_ldt_s { #define VKI_GDT_TLS_ENTRIES 3 #define VKI_GDT_TLS_MIN 6 -#define VKI_GDT_TLS_MAX (VKI_GDT_TLS_MIN + VKI_GDT_TLS_ENTRIES) +#define VKI_GDT_TLS_MAX (VKI_GDT_TLS_MIN + VKI_GDT_TLS_ENTRIES - 1) /* Flags for clone() */ /* linux/sched.h */