From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 38D2446970E for ; Thu, 9 Jan 2020 23:19:00 +0300 (MSK) Received: by mail-lf1-f68.google.com with SMTP id b15so6177470lfc.4 for ; Thu, 09 Jan 2020 12:19:00 -0800 (PST) Date: Thu, 9 Jan 2020 23:18:57 +0300 From: Cyrill Gorcunov Message-ID: <20200109201857.GG2436@uranus> References: <20200109200636.26308-1-skaplun@tarantool.org> <20200109201533.GF2436@uranus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109201533.GF2436@uranus> Subject: Re: [Tarantool-patches] [PATCH] refactoring: drop excess 16Kb bss buffer List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org, Vladislav Shpilevoy On Thu, Jan 09, 2020 at 11:15:33PM +0300, Cyrill Gorcunov wrote: ... > > @@ -140,8 +139,9 @@ backtrace() > > unw_getcontext(&unw_context); > > unw_cursor_t unw_cur; > > unw_init_local(&unw_cur, &unw_context); > > + char *backtrace_buf = (char *)static_alloc(SMALL_STATIC_SIZE); > > char *p = backtrace_buf; > > - char *end = p + sizeof(backtrace_buf) - 1; > > + char *end = p + SMALL_STATIC_SIZE - 1; > > int unw_status; > > *p = '\0'; > > while ((unw_status = unw_step(&unw_cur)) > 0) { > > static_alloc has all rights to return NULL, thus you better add > a test at least. > > NAK for a while Surely it should not fail for this exact size such as SMALL_STATIC_SIZE, still the situation may change at future, so as a minimum we need some kind of assert(backtrace_buf != NULL);