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: <CAADnVQLr7gpyCH5dRC56RO=zd8f9rL2ib4KKL3mVp+iPOs=rKQ@mail.gmail.com>
Date: Sat, 6 Jul 2024 14:14:34 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Thorsten Blum <thorsten.blum@...lux.com>
Cc: Martin KaFai Lau <martin.lau@...ux.dev>, Alexei Starovoitov <ast@...nel.org>, 
	Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, Eddy Z <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 <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Use max() instead of max_t()

On Fri, Jul 5, 2024 at 10:14 PM Thorsten Blum <thorsten.blum@...lux.com> wrote:
>
> Use max() instead of max_t(). The types are already compatible and don't
> need to be cast to u32 using max_t().
>
> Compile-tested only.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
> ---
>  kernel/bpf/bpf_local_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
> index 976cb258a0ed..f0a4f5c06b10 100644
> --- a/kernel/bpf/bpf_local_storage.c
> +++ b/kernel/bpf/bpf_local_storage.c
> @@ -779,7 +779,7 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
>
>         nbuckets = roundup_pow_of_two(num_possible_cpus());
>         /* Use at least 2 buckets, select_bucket() is undefined behavior with 1 bucket */
> -       nbuckets = max_t(u32, 2, nbuckets);
> +       nbuckets = max(2, nbuckets);

max_t is cleaner imo and u32 serves as documentation.
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ