From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 4EAFE3858C78 for ; Wed, 17 May 2023 19:42:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4EAFE3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684352520; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E4U2Hf8JxAMsnPm/bTJTuF6tXSYe5iXN3psttu2QbWY=; b=ZLquY225or+nfulHHZMUuAdwwmUVHchAAr48aLTuoRUGDfv8PtSLhRX3Ji5M+7eacVfuj4 UUP6kEWXttgiYqJg5VfOnVByz4M7HRqJRiphTO2TSM6xqdDdOPGFSEMpxylVss8x0EsuPC +Hs5NDw4SAMLr49J+J7N3/5YJJYQOos= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538--WsWBaQIPyuwp9rcqObr2w-1; Wed, 17 May 2023 15:41:57 -0400 X-MC-Unique: -WsWBaQIPyuwp9rcqObr2w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 831D62A5955C; Wed, 17 May 2023 19:41:57 +0000 (UTC) Received: from oak (unknown [10.22.32.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 671392166B31; Wed, 17 May 2023 19:41:57 +0000 (UTC) Date: Wed, 17 May 2023 15:41:56 -0400 From: Joe Simmons-Talbott To: Paul Eggert Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v3] vfprintf-internal: Replace alloca with malloc. Message-ID: <20230517194156.GH176347@oak> References: <20230515185012.2768620-1-josimmon@redhat.com> <8e9beea2-b128-83f1-dead-2c3866e28182@cs.ucla.edu> MIME-Version: 1.0 In-Reply-To: <8e9beea2-b128-83f1-dead-2c3866e28182@cs.ucla.edu> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, May 17, 2023 at 11:08:39AM -0700, Paul Eggert wrote: > On 2023-05-15 11:50, Joe Simmons-Talbott via Libc-alpha wrote: > > + args_value[cnt].pa_user = malloc (args_size[cnt]); > > + if (args_value[cnt].pa_user == NULL) > > + break; > > Shouldn't an error be returned if a printf function runs out of memory > internally? I'll fix this in the next version. Thanks. > > Also, that function already uses a scratch buffer; why not grow the scratch > buffer instead of calling malloc separately? > It seems to me that the code to grow the scratch buffer would be more difficult to understand than calling malloc separately. Perhaps I'm just intimidated by the pointer math. Thanks, Joe