Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Luis Machado <luis.machado@linaro.org>
Cc: Tom Tromey <tom@tromey.com>,
	Luis Machado via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix malloc allocation size sanity check
Date: Mon, 17 Aug 2020 12:01:30 +0100	[thread overview]
Message-ID: <20200817110130.GA9383@blade.nx> (raw)
In-Reply-To: <05c71fb9-3e87-a964-ea63-85ca4ae30bf6@linaro.org>

gdb-patches wrote:
> On 8/12/20 4:31 PM, Tom Tromey wrote:
> > > > > > > "Luis" == Luis Machado via Gdb-patches <gdb-patches@sourceware.org> writes:
> > 
> > Luis> The following patch fixes this by making the length variable a size_t.
> > 
> > main_type::length is a ULONGEST, so maybe that would be better?
> 
> Yeah, I guess. I'll change it.
> 
> I noticed xzalloc takes a size_t though.

We're allocating a buffer on the host, to hold a value from the
target.  size_t is for sizes on the host, so it's appropriate
for xzalloc, and main_type::length came from the the target, so
ULONGEST is appropriate there.  The boundary stops things being
neat :(

Cheers,
Gary

-- 
Gary Benson - he / him / his
Principal Software Engineer, Red Hat



      reply	other threads:[~2020-08-17 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 19:17 Luis Machado
2020-08-12 19:31 ` Tom Tromey
2020-08-12 19:32   ` Tom Tromey
2020-08-12 19:46   ` Luis Machado
2020-08-17 11:01     ` Gary Benson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200817110130.GA9383@blade.nx \
    --to=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@linaro.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox