[02/12] crypto/cnxk: fix build with GCC 12
Checks
Commit Message
GCC 12 raises the following warning:
In file included from ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:17:
In function ‘fill_sg_comp_from_iov’,
inlined from ‘cpt_kasumi_enc_prep’ at
../drivers/crypto/cnxk/cnxk_se.h:1413:8,
inlined from ‘cpt_fc_enc_hmac_prep’ at
../drivers/crypto/cnxk/cnxk_se.h:1635:9,
inlined from ‘fill_digest_params’ at
../drivers/crypto/cnxk/cnxk_se.h:2524:8,
inlined from ‘cpt_sym_inst_fill’ at
../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:92:9,
inlined from ‘cn10k_cpt_fill_inst.constprop.isra’ at
../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:146:10:
../drivers/crypto/cnxk/cnxk_se.h:208:52: error: array subscript 0 is
outside array bounds of ‘struct roc_se_buf_ptr[0]’
[-Werror=array-bounds]
208 | e_vaddr = (uint64_t)bufs[j].vaddr;
| ~~~~~~~^~~~~~
../drivers/crypto/cnxk/cnxk_se.h:209:48: error: array subscript 0 is
outside array bounds of ‘struct roc_se_buf_ptr[0]’
[-Werror=array-bounds]
209 | e_len = (size > bufs[j].size) ? bufs[j].size : size;
| ~~~~~~~^~~~~
For now, waive this warning until we have a proper fix.
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
drivers/crypto/cnxk/cnxk_se.h | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Wed, 18 May 2022 12:16:47 +0200
David Marchand <david.marchand@redhat.com> wrote:
> GCC 12 raises the following warning:
>
> In file included from ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:17:
> In function ‘fill_sg_comp_from_iov’,
> inlined from ‘cpt_kasumi_enc_prep’ at
> ../drivers/crypto/cnxk/cnxk_se.h:1413:8,
> inlined from ‘cpt_fc_enc_hmac_prep’ at
> ../drivers/crypto/cnxk/cnxk_se.h:1635:9,
> inlined from ‘fill_digest_params’ at
> ../drivers/crypto/cnxk/cnxk_se.h:2524:8,
> inlined from ‘cpt_sym_inst_fill’ at
> ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:92:9,
> inlined from ‘cn10k_cpt_fill_inst.constprop.isra’ at
> ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:146:10:
> ../drivers/crypto/cnxk/cnxk_se.h:208:52: error: array subscript 0 is
> outside array bounds of ‘struct roc_se_buf_ptr[0]’
> [-Werror=array-bounds]
> 208 | e_vaddr = (uint64_t)bufs[j].vaddr;
> | ~~~~~~~^~~~~~
> ../drivers/crypto/cnxk/cnxk_se.h:209:48: error: array subscript 0 is
> outside array bounds of ‘struct roc_se_buf_ptr[0]’
> [-Werror=array-bounds]
> 209 | e_len = (size > bufs[j].size) ? bufs[j].size : size;
> | ~~~~~~~^~~~~
>
> For now, waive this warning until we have a proper fix.
>
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
If you fix iov_ptr_t to be flexible array this won't be needed.
@@ -205,8 +205,16 @@ fill_sg_comp_from_iov(struct roc_se_sglist_comp *list, uint32_t i,
size;
from_offset = 0;
} else {
+/* FIXME */
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
e_vaddr = (uint64_t)bufs[j].vaddr;
e_len = (size > bufs[j].size) ? bufs[j].size : size;
+#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000)
+#pragma GCC diagnostic pop
+#endif
}
to->u.s.len[i % 4] = rte_cpu_to_be_16(e_len);