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] [day] [month] [year] [list]
Message-ID: <cef129cd-44b2-449c-8a60-c918af005cbc@heusel.eu>
Date: Sat, 2 Nov 2024 12:27:36 +0100
From: Christian Heusel <christian@...sel.eu>
To: Colin Ian King <colin.i.king@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>, 
	Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, 
	Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, 
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, 
	Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>, bpf@...r.kernel.org, 
	kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] bpf: replace redundant |= operation with assignmen

On 24/10/31 01:07PM, Colin Ian King wrote:
> The operation msk |= ~0ULL contains a redundant bit-wise or operation
> since all the bits are going to be set to 1, so replace this with
> an assignment since this is more optimal and probably clearer too.
> 
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>
> ---
>  kernel/bpf/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
> index 9aaf5124648b..fea07e12601f 100644
> --- a/kernel/bpf/inode.c
> +++ b/kernel/bpf/inode.c
> @@ -914,7 +914,7 @@ static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param)
>  		str = param->string;
>  		while ((p = strsep(&str, ":"))) {
>  			if (strcmp(p, "any") == 0) {
> -				msk |= ~0ULL;
> +				msk = ~0ULL;
>  			} else if (find_btf_enum_const(info.btf, enum_t, enum_pfx, p, &val)) {
>  				msk |= 1ULL << val;
>  			} else {
> -- 
> 2.39.5

The patch subject contains a typo ("assignmen" should be "assignment"),
but maybe this can just be fixed on apply ..

Cheers,
Chris

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ