Re: [PATCH v3] builtin/mv.c: use the MOVE_ARRAY() macro instead of memmove()

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

 



On 7/9/2022 9:33 PM, Junio C Hamano wrote:
> The variables 'source', 'destination', and 'submodule_gitfile' are
> all of type "const char **", and an element of such an array is of
> "type const char *", but these memmove() calls were written as if
> these variables are of type "char **".
> 
> Once these memmove() calls are fixed to use the correct type to
> compute the number of bytes to be moved, e.g.
> 
> -      memmove(source + i, source + i + 1, n * sizeof(char *));
> +      memmove(source + i, source + i + 1, n * sizeof(const char *));
> 
> existing contrib/coccinelle/array.cocci rules can recognize them as
> candidates for turning into MOVE_ARRAY().
> 
> While at it, use CALLOC_ARRAY() instead of xcalloc() to allocate the
> modes[] array that is involved in the change.

I'm super late in noticing this, but these changes will fix the
static-analysis build in the CI build, so the sooner this can make
it to master the better.

Thanks!
-Stolee




[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]

  Powered by Linux