lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250609172654.a99c06d8ad90a6a994545e5f@linux-foundation.org>
Date: Mon, 9 Jun 2025 17:26:54 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Ye Liu <ye.liu@...ux.dev>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, Ye Liu
 <liuye@...inos.cn>
Subject: Re: [PATCH] mm/memfd: Rename error labels for clarity

On Mon,  9 Jun 2025 11:18:58 +0800 Ye Liu <ye.liu@...ux.dev> wrote:

> From: Ye Liu <liuye@...inos.cn>
> 
> err_name --> err_fd (fd failure case)
> err_fd --> err_file (file failure case)
> 
> ...
>
> --- a/mm/memfd.c
> +++ b/mm/memfd.c
> @@ -475,22 +475,22 @@ SYSCALL_DEFINE2(memfd_create,
>  	fd = get_unused_fd_flags((flags & MFD_CLOEXEC) ? O_CLOEXEC : 0);
>  	if (fd < 0) {
>  		error = fd;
> -		goto err_name;
> +		goto err_fd;
>  	}
>  
>  	file = alloc_file(name, flags);
>  	if (IS_ERR(file)) {
>  		error = PTR_ERR(file);
> -		goto err_fd;
> +		goto err_file;
>  	}
>  
>  	fd_install(fd, file);
>  	kfree(name);
>  	return fd;
>  
> -err_fd:
> +err_file:
>  	put_unused_fd(fd);
> -err_name:
> +err_fd:
>  	kfree(name);
>  	return error;
>  }

Not really, but I see what you mean.

"err_name" means "there was an error, so free the name". 

"err_fd" means "there was a problem with the fd".


We tend to use the former convention.  See

	grep err_free mm/*.c

The memfd_create() code would be better if it used "err_free_name" and
"err_free_fd" to remove this ambiguity.

Someone who was feeling bored could go through

	grep "goto err_" mm/*.c

and check that we use this convention uniformly ;)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ