public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: jacob navia <jacob@jacob.remcomp.fr>
Cc: binutils@sourceware.org
Subject: Re: Missing NULL check
Date: Wed, 13 Sep 2023 16:20:24 +0930	[thread overview]
Message-ID: <ZQFbsM23ZukbnqNL@squeak.grove.modra.org> (raw)
In-Reply-To: <69AA9E49-F26A-4DAC-B120-70940C3A59B1@jacob.remcomp.fr>

On Tue, Sep 12, 2023 at 05:40:45PM +0200, jacob navia wrote:
> Add
> if (list == NULL) return NULL;

Yes, we should be testing for a NULL return from bfd_alloc, but error
handling then needs to be propagated up the call chain.  If
elf_new_obj_attr returns NULL then all its callers will segfault
unless they are changed too.  We also don't want to hide allocation
failures which means functions like bfd_elf_add_obj_attr_int should
return the obj_attribute pointer rather than void, and all callers
should check the return value.  I'll write a patch to do that.

-- 
Alan Modra
Australia Development Lab, IBM

      parent reply	other threads:[~2023-09-13  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 15:40 jacob navia
2023-09-12 18:50 ` Torbjorn SVENSSON
2023-09-12 19:34   ` Fangrui Song
2023-09-13 10:57     ` Nick Clifton
     [not found]   ` <DS7PR12MB5765DD3A03E4B143B950C3D6CBF1A@DS7PR12MB5765.namprd12.prod.outlook.com>
2023-09-13 14:28     ` jacob navia
2023-09-13  6:50 ` Alan Modra [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=ZQFbsM23ZukbnqNL@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jacob@jacob.remcomp.fr \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).