Re: [PATCH 1/6] object.c: stop supporting len == -1 in type_from_string_gently()

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

 



On Fri, Apr 09, 2021 at 10:32:49AM +0200, Ævar Arnfjörð Bjarmason wrote:

> diff --git a/object.c b/object.c
> index 7fdca3ed1e..88de01e5ac 100644
> --- a/object.c
> +++ b/object.c
> @@ -39,9 +39,6 @@ int type_from_string_gently(const char *str, ssize_t len, int gentle)
>  {
>  	int i;
>  
> -	if (len < 0)
> -		len = strlen(str);
> -

The "ssize_t len" in the parameters could become a size_t now, right?

Not strictly necessary, but in theory it may help static analysis catch
a caller who mistakenly tries to pass -1 (though in practice I suspect
it does not help that much, because any of gcc's sign-conversion
warnings generate far too much noise to be useful with our current
codebase).

-Peff



[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