Re: [PATCH v2 1/2] pfinet: add MAP_FAILED check after mmap in S_pfinet_siocgifconf

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.bugs
Organization I am not organized
Message-ID <aiWuic8chF3ATB5c@end>
Hello,

Sophiel Zhou, le lun. 08 juin 2026 01:42:52 +0800, a ecrit:
> diff --git a/pfinet/pfinet-ops.c b/pfinet/pfinet-ops.c
> index fab57570..dd571bfb 100644
> --- a/pfinet/pfinet-ops.c
> +++ b/pfinet/pfinet-ops.c
> @@ -77,8 +77,16 @@ S_pfinet_siocgifconf (io_t port,
>      {
>        /* Possibly allocate a new buffer. */
>        if (*len < amount)
> -	ifc.ifc_buf = (char *) mmap (0, amount, PROT_READ|PROT_WRITE,
> -				     MAP_ANON, 0, 0);
> +	{
> +	  ifc.ifc_buf = (char *) mmap (0, amount, PROT_READ|PROT_WRITE,
> +				       MAP_ANON, 0, 0);
> +	  if (ifc.ifc_buf == MAP_FAILED)
> +	    {
> +        pthread_mutex_unlock(&global_lock);
> +        /* Should use errno here, but glue headers #undef errno */    
> +	      return ENOMEM;

There are indentation issues.

Samuel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.