From patchwork Tue Feb 3 15:47:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 435962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49EBC140129 for ; Wed, 4 Feb 2015 02:47:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=HbMM 8dpByfEpVHvVn1M9GT/HlRkCZlqgWoRbFZDkzGDpWv4iXN69Bxi+Vbt9sPUMpqaz KaDYj5PoFnwGZ6vBko7MAF247y7Wx2Q9GjauTE+Ekgoodtob5B+3S5gFc1RHlXvK bF+h/zq0toOFOeVebtsS3SMBpTOwpj+whZVRdiw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=aDWoMsOKdG tUTaKKn6NVtZIXKPc=; b=gbDv18ar0poVFo5WTm3SkLX+CCU+WSFEybhu3PLl1n XhgVltqjLXo+hNZMN49qyFhBVRbtWqNaqMPc9PWMWlvzzmW9QO22p8hUQWryF6zR MkBUGjoKljHZfdoZ9Xgyp/lorY0SRxpUfR04zltb+zxhvOYcb7RW337afFw4NbWg I= Received: (qmail 19656 invoked by alias); 3 Feb 2015 15:47:15 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 19643 invoked by uid 89); 3 Feb 2015 15:47:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Tue, 3 Feb 2015 21:17:03 +0530 From: Siddhesh Poyarekar To: "H.J. Lu" Cc: GNU C Library , bug-gnulib@gnu.org Subject: Re: [PATCH] Initialize the entire obstack struct [BZ #17919] Message-ID: <20150203154703.GI1528@spoyarek.pnq.redhat.com> References: <20150203145649.GG1528@spoyarek.pnq.redhat.com> <20150203150036.GH1528@spoyarek.pnq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) On Tue, Feb 03, 2015 at 07:38:43AM -0800, H.J. Lu wrote: > > I think you should also remove > > > > h->use_extra_arg = 0; > > > > And > > /* The initial chunk now contains no empty object. */ > h->maybe_empty_object = 0; > h->alloc_failed = 0; Done. Verified on s390x. Siddhesh ChangeLog for gnulib: obstack: Initialize whole obstack structure. * lib/obstack.c (_obstack_begin): Initialize all of H. ChangeLog for glibc: [BZ #17919] * malloc/obstack.c (_obstack_begin): Initialize all of H. diff --git a/malloc/obstack.c b/malloc/obstack.c index 5bb3f0d..1957402 100644 --- a/malloc/obstack.c +++ b/malloc/obstack.c @@ -148,6 +148,8 @@ _obstack_begin (struct obstack *h, { struct _obstack_chunk *chunk; /* points to new chunk */ + memset (h, 0, sizeof (struct obstack)); + if (alignment == 0) alignment = DEFAULT_ALIGNMENT; if (size == 0) @@ -171,7 +173,6 @@ _obstack_begin (struct obstack *h, h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun; h->chunk_size = size; h->alignment_mask = alignment - 1; - h->use_extra_arg = 0; chunk = h->chunk = CALL_CHUNKFUN (h, h->chunk_size); if (!chunk) @@ -181,9 +182,6 @@ _obstack_begin (struct obstack *h, h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size; chunk->prev = 0; - /* The initial chunk now contains no empty object. */ - h->maybe_empty_object = 0; - h->alloc_failed = 0; return 1; }