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]
Date:   Fri, 20 Jan 2017 08:19:14 +0100
From:   Ingo Molnar <mingo@...nel.org>
To:     Jason Baron <jbaron@...mai.com>
Cc:     peterz@...radead.org, rostedt@...dmis.org,
        linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2] jump_label: reduce the size of struct static_key


* Jason Baron <jbaron@...mai.com> wrote:

>  struct static_key {
>  	atomic_t enabled;
> +/*
> + * bit 0 => 1 if key is initially true
> + *	    0 if initially false
> + * bit 1 => 1 if points to struct static_key_mod
> + *	    0 if points to struct jump_entry
> + */
> +	union {
> +		unsigned long type;
> +		struct jump_entry *entries;
> +		struct static_key_mod *next;
> +	};


> +			key->type = (unsigned long)jlm2 | static_key_type(key);

> +		key->type = (unsigned long)jlm | static_key_type(key);

> +		*prev = (struct static_key_mod *)((unsigned long)jlm->next |
> +				((unsigned long)*prev & JUMP_TYPE_MASK));

> +			key->type = (unsigned long)jlm->entries |
> +					static_key_type(key);

I really hate these very ugly type conversions. Is there no cleaner way?

For example the last line could sure be written as:

			key->entries = jlm->entries;
			key->type |= static_key_type(key);

right?

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ