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.129.124]) by sourceware.org (Postfix) with ESMTPS id 754053858D37 for ; Fri, 22 Sep 2023 14:24:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 754053858D37 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=1695392698; 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=+AIz01L3tRbJ6NUH1CZ8u6XW9JmZhqmWzYqJR9bTRj4=; b=GDtF07/P2wbNGuM6zKfQ1vogumkO2f8ciVZ69O00Succ6BzpPw+1ff2NDOZP7sTKOVTEba eT8uUczQ3JMxLDtuXHRT83p5EEJBsnwPtuUOLeDxDv3ozEUTjf0int2zaLDnFfvoEXbtcF cCZFmVGxcHaX64GD+ZohUy3hdf+Q6Rs= Received: from mimecast-mx02.redhat.com (mx-ext.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-433-qHGOGGqHPmCPhSA_nKkHfQ-1; Fri, 22 Sep 2023 10:24:56 -0400 X-MC-Unique: qHGOGGqHPmCPhSA_nKkHfQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2BF653811F26; Fri, 22 Sep 2023 14:24:56 +0000 (UTC) Received: from oak (unknown [10.22.32.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E19B10F1BE7; Fri, 22 Sep 2023 14:24:55 +0000 (UTC) Date: Fri, 22 Sep 2023 10:24:54 -0400 From: Joe Simmons-Talbott To: Andreas Schwab Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] resolv: Get rid of alloca usage. Message-ID: <20230922142454.GU3849957@oak> References: <20230921161613.3609632-1-josimmon@redhat.com> <875y43tomv.fsf@igel.home> MIME-Version: 1.0 In-Reply-To: <875y43tomv.fsf@igel.home> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=-10.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,TXREP 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 Thu, Sep 21, 2023 at 07:36:08PM +0200, Andreas Schwab wrote: > On Sep 21 2023, Joe Simmons-Talbott wrote: > > > diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c > > index 1e6511a4f4..b67542c078 100644 > > --- a/resolv/nss_dns/dns-network.c > > +++ b/resolv/nss_dns/dns-network.c > > @@ -116,6 +116,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result, > > querybuf *orig_net_buffer; > > int anslen; > > enum nss_status status; > > + char buf[1024]; > > > > struct resolv_context *ctx = __resolv_context_get (); > > if (ctx == NULL) > > @@ -125,7 +126,7 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result, > > return NSS_STATUS_UNAVAIL; > > } > > > > - net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024); > > + net_buffer.buf = orig_net_buffer = (querybuf *) &buf; > > The buffer should be suitably aligned for querybuf. Since buf is an > array, it should not get an address-of operator. > I've posted a v2 which hopefully addresses this. Thanks, Joe