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: <20250114183735.15aea391@kernel.org>
Date: Tue, 14 Jan 2025 18:37:35 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Tariq Toukan <tariqt@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>, Paolo Abeni
 <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>, "Andrew Lunn"
 <andrew+netdev@...n.ch>, <netdev@...r.kernel.org>, Saeed Mahameed
 <saeedm@...dia.com>, Gal Pressman <gal@...dia.com>, Leon Romanovsky
 <leonro@...dia.com>, Mark Bloch <mbloch@...dia.com>, Moshe Shemesh
 <moshe@...dia.com>
Subject: Re: [PATCH net 6/8] net/mlx5e: Properly match IPsec subnet
 addresses

On Mon, 13 Jan 2025 17:40:52 +0200 Tariq Toukan wrote:
> +static void addr4_to_mask(__be32 *addr, __be32 *mask)
> +{
> +	int i;
> +
> +	*mask = 0;
> +	for (i = 0; i < 4; i++)
> +		*mask |= ((*addr >> 8 * i) & 0xFF) ? (0xFF << 8 * i) : 0;

sparse is unimpressed with the lack of byteswaps here.

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:1159:28: warning: restricted __be32 degrades to integer
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:1159:23: warning: invalid assignment: |=
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:1159:23:    left side has type restricted __be32
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c:1159:23:    right side has type int


Maybe just force cast to u32 inside the helper, and add a comment why?
Or just byte swap.

Also from the word mask and subnet in the commit message it sounds like
you are shooting for a prefix. But this does "byte enable" kind of
thing :S Think 10.0.55.0/24. Maybe mention if this is intentional in
a comment, too.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ