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: <Z9M1A8lOuXE4UkyR@shredder>
Date: Thu, 13 Mar 2025 21:41:55 +0200
From: Ido Schimmel <idosch@...dia.com>
To: WangYuli <wangyuli@...ontech.com>
Cc: Paolo Abeni <pabeni@...hat.com>, andrew+netdev@...n.ch,
	chenlinxuan@...ontech.com, czj2441@....com, davem@...emloft.net,
	edumazet@...gle.com, guanwentao@...ontech.com, kuba@...nel.org,
	linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
	niecheng1@...ontech.com, petrm@...dia.com, zhanjun@...ontech.com
Subject: Re: [PATCH net 1/2] mlxsw: spectrum_acl_bloom_filter: Expand
 chunk_key_offsets[chunk_index]

Please use plain text emails.

On Fri, Mar 14, 2025 at 12:10:42AM +0800, WangYuli wrote:
> My tests still show the same compilation failing.

It passed with clang 18 on Fedora 40, but now I tested with clang 19 on
Fedora 41 and it's indeed failing.

How about [1]? It's similar to yours and passes with both clang
versions.

Thanks

[1]
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
index a54eedb69a3f..9c54dba5ad12 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
@@ -212,7 +212,22 @@ static const u8 mlxsw_sp4_acl_bf_crc6_tab[256] = {
  * This array defines key offsets for easy access when copying key blocks from
  * entry key to Bloom filter chunk.
  */
-static const u8 chunk_key_offsets[MLXSW_BLOOM_KEY_CHUNKS] = {2, 20, 38};
+static char *
+mlxsw_sp_acl_bf_enc_key_get(struct mlxsw_sp_acl_atcam_entry *aentry,
+                           u8 chunk_index)
+{
+       switch (chunk_index) {
+       case 0:
+               return &aentry->ht_key.enc_key[2];
+       case 1:
+               return &aentry->ht_key.enc_key[20];
+       case 2:
+               return &aentry->ht_key.enc_key[38];
+       default:
+               WARN_ON_ONCE(1);
+               return &aentry->ht_key.enc_key[0];
+       }
+}
 
 static u16 mlxsw_sp2_acl_bf_crc16_byte(u16 crc, u8 c)
 {
@@ -245,12 +260,13 @@ __mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
                                   (aregion->region->id << 4));
        for (chunk_index = max_chunks - chunk_count; chunk_index < max_chunks;
             chunk_index++) {
+               char *enc_key;
+
                memset(chunk, 0, pad_bytes);
                memcpy(chunk + pad_bytes, &erp_region_id,
                       sizeof(erp_region_id));
-               memcpy(chunk + key_offset,
-                      &aentry->ht_key.enc_key[chunk_key_offsets[chunk_index]],
-                      chunk_key_len);
+               enc_key = mlxsw_sp_acl_bf_enc_key_get(aentry, chunk_index);
+               memcpy(chunk + key_offset, enc_key, chunk_key_len);
                chunk += chunk_len;
        }
        *len = chunk_count * chunk_len;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ