[v2] resolv: Get rid of alloca usage.
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
Replace alloca usage with char arrays in _nss_dns_getnetbyname_r and
_nss_dns_getnetbyaddr_r.
---
resolv/nss_dns/dns-network.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
Ping.
On Fri, Sep 22, 2023 at 10:10:33AM -0400, Joe Simmons-Talbott wrote:
> Replace alloca usage with char arrays in _nss_dns_getnetbyname_r and
> _nss_dns_getnetbyaddr_r.
> ---
> resolv/nss_dns/dns-network.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
> index 1e6511a4f4..b429384da1 100644
> --- a/resolv/nss_dns/dns-network.c
> +++ b/resolv/nss_dns/dns-network.c
> @@ -116,6 +116,8 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
> querybuf *orig_net_buffer;
> int anslen;
> enum nss_status status;
> + char buf[1024] __attribute__ ((__aligned__ (__alignof__ (querybuf))));
> +
>
> struct resolv_context *ctx = __resolv_context_get ();
> if (ctx == NULL)
> @@ -125,7 +127,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;
>
> anslen = __res_context_search
> (ctx, name, C_IN, T_PTR, net_buffer.buf->buf,
> @@ -170,6 +172,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
> int cnt, anslen;
> uint32_t net2;
> int olderr = errno;
> + char buf[1024] __attribute__ ((__aligned__ (__alignof__ (querybuf))));
>
> /* No net address lookup for IPv6 yet. */
> if (type != AF_INET)
> @@ -209,7 +212,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
> break;
> }
>
> - net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
> + net_buffer.buf = orig_net_buffer = (querybuf *) buf;
>
> anslen = __res_context_query (ctx, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
> 1024, &net_buffer.ptr, NULL, NULL, NULL, NULL);
> --
> 2.39.2
>
Ping.
On Mon, Oct 02, 2023 at 08:25:52AM -0400, Joe Simmons-Talbott wrote:
> Ping.
>
> On Fri, Sep 22, 2023 at 10:10:33AM -0400, Joe Simmons-Talbott wrote:
> > Replace alloca usage with char arrays in _nss_dns_getnetbyname_r and
> > _nss_dns_getnetbyaddr_r.
> > ---
> > resolv/nss_dns/dns-network.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
> > index 1e6511a4f4..b429384da1 100644
> > --- a/resolv/nss_dns/dns-network.c
> > +++ b/resolv/nss_dns/dns-network.c
> > @@ -116,6 +116,8 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
> > querybuf *orig_net_buffer;
> > int anslen;
> > enum nss_status status;
> > + char buf[1024] __attribute__ ((__aligned__ (__alignof__ (querybuf))));
> > +
> >
> > struct resolv_context *ctx = __resolv_context_get ();
> > if (ctx == NULL)
> > @@ -125,7 +127,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;
> >
> > anslen = __res_context_search
> > (ctx, name, C_IN, T_PTR, net_buffer.buf->buf,
> > @@ -170,6 +172,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
> > int cnt, anslen;
> > uint32_t net2;
> > int olderr = errno;
> > + char buf[1024] __attribute__ ((__aligned__ (__alignof__ (querybuf))));
> >
> > /* No net address lookup for IPv6 yet. */
> > if (type != AF_INET)
> > @@ -209,7 +212,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
> > break;
> > }
> >
> > - net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
> > + net_buffer.buf = orig_net_buffer = (querybuf *) buf;
> >
> > anslen = __res_context_query (ctx, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
> > 1024, &net_buffer.ptr, NULL, NULL, NULL, NULL);
> > --
> > 2.39.2
> >
>
@@ -116,6 +116,8 @@ _nss_dns_getnetbyname_r (const char *name, struct netent *result,
querybuf *orig_net_buffer;
int anslen;
enum nss_status status;
+ char buf[1024] __attribute__ ((__aligned__ (__alignof__ (querybuf))));
+
struct resolv_context *ctx = __resolv_context_get ();
if (ctx == NULL)
@@ -125,7 +127,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;
anslen = __res_context_search
(ctx, name, C_IN, T_PTR, net_buffer.buf->buf,
@@ -170,6 +172,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
int cnt, anslen;
uint32_t net2;
int olderr = errno;
+ char buf[1024] __attribute__ ((__aligned__ (__alignof__ (querybuf))));
/* No net address lookup for IPv6 yet. */
if (type != AF_INET)
@@ -209,7 +212,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, int type, struct netent *result,
break;
}
- net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
+ net_buffer.buf = orig_net_buffer = (querybuf *) buf;
anslen = __res_context_query (ctx, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
1024, &net_buffer.ptr, NULL, NULL, NULL, NULL);