Re: [PATCH v3 1/2] Fix nonnull errors reported by UBSAN with GCC 7.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]