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: <YiwSYvuAkntr4A/V@zeniv-ca.linux.org.uk>
Date:   Sat, 12 Mar 2022 03:24:18 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Meng Tang <tangmeng@...ontech.com>
Cc:     mcgrof@...nel.org, keescook@...omium.org, yzaikin@...gle.com,
        ebiederm@...ssion.com, willy@...radead.org, nixiaoming@...wei.com,
        nizhen@...ontech.com, zhanglianjie@...ontech.com,
        sujiaxun@...ontech.com, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 1/2] fs/proc: optimize exactly register one ctl_table

On Thu, Mar 03, 2022 at 03:08:46PM +0800, Meng Tang wrote:

> +#define REGISTER_SINGLE_ONE (register_single_one ? true : false)

????

> +static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header,
> +	bool register_single_one)

> +	err = insert_links(header, REGISTER_SINGLE_ONE);

> +	erase_header(header, REGISTER_SINGLE_ONE);
> +	put_links(header, REGISTER_SINGLE_ONE);


>  static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table *table,
> -	struct ctl_table_root *link_root)
> +	struct ctl_table_root *link_root, bool register_single_one)

> +	init_header(links, dir->header.root, dir->header.set, node, link_table,
> +		    REGISTER_SINGLE_ONE);

> -static int insert_links(struct ctl_table_header *head)
> +static int insert_links(struct ctl_table_header *head, bool register_single_one)
>  {
>  	struct ctl_table_set *root_set = &sysctl_table_root.default_set;
>  	struct ctl_dir *core_parent = NULL;
> @@ -1248,13 +1278,13 @@ static int insert_links(struct ctl_table_header *head)
>  	if (IS_ERR(core_parent))
>  		return 0;
>  
> -	if (get_links(core_parent, head->ctl_table, head->root))
> +	if (get_links(core_parent, head->ctl_table, head->root, REGISTER_SINGLE_ONE))

> -	links = new_links(core_parent, head->ctl_table, head->root);
> +	links = new_links(core_parent, head->ctl_table, head->root, REGISTER_SINGLE_ONE);

> +	if (get_links(core_parent, head->ctl_table, head->root, REGISTER_SINGLE_ONE)) {

> +	err = insert_header(core_parent, links, REGISTER_SINGLE_ONE);

> -struct ctl_table_header *__register_sysctl_table(
> +struct ctl_table_header *__register_sysctl_tables(
>  	struct ctl_table_set *set,
> -	const char *path, struct ctl_table *table)
> +	const char *path, struct ctl_table *table, bool register_single_one)

> +	init_header(header, root, set, node, table, REGISTER_SINGLE_ONE);
> +	if (sysctl_check_table(path, table, REGISTER_SINGLE_ONE))

> +	if (insert_header(dir, header, REGISTER_SINGLE_ONE))

>  static int register_leaf_sysctl_tables(const char *path, char *pos,
>  	struct ctl_table_header ***subheader, struct ctl_table_set *set,
> -	struct ctl_table *table)
> +	struct ctl_table *table, bool register_single_one)

> +		header = __register_sysctl_tables(set, path, files, REGISTER_SINGLE_ONE);


Could you explain what is that REGISTER_SINGLE_ONE macro for?  Looks like
some very odd kind of cargo-culting...  I might be missing something subtle
here, but I'm honestly at loss as to what could that possibly be.  If nothing
else, why would one ever want boolean_expression ? true : false instead of
boolean_expression?  Especially since in all cases you are passing that
as a bool argument...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ