diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-06-06 16:57:13 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-06-13 08:31:41 +0200 |
commit | 1793d1aba1941573ba9ebf75dfbb11a8c2b943b1 (patch) | |
tree | f5fb556a4e5e654b39d79781c788494b069e4ca2 /net | |
parent | ARM: dts: imx7ulp: add crypto support (diff) | |
download | linux-1793d1aba1941573ba9ebf75dfbb11a8c2b943b1.tar.xz linux-1793d1aba1941573ba9ebf75dfbb11a8c2b943b1.zip |
crypto: qat - use struct_size() helper
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
struct qat_alg_buf_list {
...
struct qat_alg_buf bufers[];
} __packed __aligned(64);
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
So, replace the following form:
sizeof(struct qat_alg_buf_list) + ((1 + n) * sizeof(struct qat_alg_buf))
with:
struct_size(bufl, bufers, n + 1)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions