From: Johannes Sixt <j6t@kdbg.org>
To: "Junio C Hamano" <gitster@pobox.com>, "Martin Liška" <mliska@suse.cz>
Cc: "René Scharfe" <l.s.r@web.de>, "Jeff King" <peff@peff.net>,
git@vger.kernel.org
Subject: Re: [PATCH v3 1/2] Fix nonnull errors reported by UBSAN with GCC 7.
Date: Mon, 17 Apr 2017 09:59:29 +0200 [thread overview]
Message-ID: <930be745-944f-62f3-3d57-4f1cd6f2df66@kdbg.org> (raw)
In-Reply-To: <xmqqy3uzkdm4.fsf@gitster.mtv.corp.google.com>
Am 17.04.2017 um 03:49 schrieb Junio C Hamano:
> "Something or NULL" is a name we use for a function that returns
> something (under normal circumstances) or returns NULL. This
> wrapper is not about returning NULL at all, as far as I can see, and
> is misnamed. If it is about "avoid moving 0 bytes", similar to how
> COPY_ARRAY() is used in the previous hunk, perhaps MOVE_ARRAY() is a
> better name?
It is not about "avoid moving 0 bytes", but "if we move 0 bytes, then we
allow NULL pointers". Plain memmove/memcpy do not allow the pointers to
be NULL even if the count is 0. It just so happens that the
implementation of memmove_or_null that permits the relaxed condition
looks like "avoid moving 0 bytes".
The name was my suggestion, but I agree that it is not the best name.
[Sentence about two most difficult things in software engineering
omitted for brevity.]
-- Hannes
next prev parent reply other threads:[~2017-04-17 7:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 8:02 [PATCH 1/2] Fix nonnull errors reported by UBSAN with GCC 7 Martin Liška
2017-04-06 8:34 ` Jeff King
2017-04-06 9:52 ` [PATCH v2 " Martin Liška
2017-04-06 12:26 ` René Scharfe
2017-04-06 15:42 ` [PATCH v3 " Martin Liška
2017-04-06 16:33 ` Johannes Sixt
2017-04-06 17:31 ` René Scharfe
2017-04-06 20:49 ` Johannes Sixt
2017-04-07 14:23 ` Martin Liška
2017-04-07 15:25 ` René Scharfe
2017-04-07 15:25 ` [PATCH 1/2] add MOVE_ARRAY René Scharfe
2017-04-07 15:25 ` [PATCH 2/2] use MOVE_ARRAY René Scharfe
2017-04-17 1:49 ` [PATCH v3 1/2] Fix nonnull errors reported by UBSAN with GCC 7 Junio C Hamano
2017-04-17 7:59 ` Johannes Sixt [this message]
2017-04-06 8:57 ` [PATCH " Johannes Schindelin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=930be745-944f-62f3-3d57-4f1cd6f2df66@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=mliska@suse.cz \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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).