From: Florian Krohm Date: Mon, 24 Nov 2014 17:30:01 +0000 (+0000) Subject: As the BEAM checker correctly points out, the conditions on lines 430 and 485 X-Git-Tag: svn/VALGRIND_3_11_0~805 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=872d358bab4f785c6cc0946e4689f54e5e5d794b;p=thirdparty%2Fvalgrind.git As the BEAM checker correctly points out, the conditions on lines 430 and 485 are always false. I'm keeping them as assertions for documentation purposes. The proof is left as exercise to the reader. Hint: use conditions on lines 307 and 311 and the fact that old_len and old_arg are both unsigned entities. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14778 --- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 9445011023..56d5718a5e 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -427,10 +427,8 @@ SysRes do_mremap( Addr old_addr, SizeT old_len, SSizeT needL = new_len - old_len; vg_assert(needL > 0); - if (needA == 0) - goto eINVAL; - /* VG_(am_get_advisory_client_simple) interprets zero to mean - non-fixed, which is not what we want */ + vg_assert(needA > 0); + advised = VG_(am_get_advisory_client_simple)( needA, needL, &ok ); if (ok) { /* Fixes bug #129866. */ @@ -482,10 +480,9 @@ SysRes do_mremap( Addr old_addr, SizeT old_len, { Addr needA = old_addr + old_len; SizeT needL = new_len - old_len; - if (needA == 0) - goto eINVAL; - /* VG_(am_get_advisory_client_simple) interprets zero to mean - non-fixed, which is not what we want */ + + vg_assert(needA > 0); + advised = VG_(am_get_advisory_client_simple)( needA, needL, &ok ); if (ok) { /* Fixes bug #129866. */