crypto: qat - fix bug in ADF_RING_SIZE_BYTES_MIN macro
PATCH 1/1 crypto: qat - fix bug in ADF_RING_SIZE_BYTES_MIN macro
From: Bruce Allan <[email protected]>
The subject macro mistakenly compares the passed-in ring size in bytes with ADF_RING_SIZE_4K which is 0x6 (an internal representation of 4KB) rather than comparing with the intended value of 4096.
Signed-off-by Bruce Allan <[email protected]>
Signed-off-by Tadeusz Struk <[email protected]>
--- .../qat/qat_common/adf_transport_access_macros.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/adf_transport_access_macros.h +3 -2
@@ -97,8 +97,9 @@#define ADF_RING_SIZE_IN_BYTES_TO_SIZE (SIZE ) ((1 << (SIZE - 1)) >> 7)/* Minimum ring bufer size for memory allocation */ -#define ADF_RING_SIZE_BYTES_MIN (SIZE ) ((SIZE < ADF_RING_SIZE_4K) ? \ - ADF_RING_SIZE_4K : SIZE) +#define ADF_RING_SIZE_BYTES_MIN (SIZE ) \ + ((SIZE < ADF_SIZE_TO_RING_SIZE_IN_BYTES(ADF_RING_SIZE_4K)) ? \ + ADF_SIZE_TO_RING_SIZE_IN_BYTES(ADF_RING_SIZE_4K) : SIZE)#define ADF_RING_SIZE_MODULO (SIZE ) (SIZE + 0x6)#define ADF_SIZE_TO_POW (SIZE ) ((((SIZE & 0x4) >> 1) | ((SIZE & 0x4) >> 2) | \ SIZE) & ~0x4)
Quoted 8 lines · Tadeusz Struk
From: Bruce Allan <[email protected]>
The subject macro mistakenly compares the passed-in ring size in bytes with
ADF_RING_SIZE_4Kwhich is0x6(an internal representation of 4KB) rather than comparing with the intended value of 4096.Signed-off-by Bruce Allan <[email protected]>Signed-off-by Tadeusz Struk <[email protected]>
Applied.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt