crypto: marvell/cesa - Fix type mismatch warning
Subsystems (2)
PATCH 1/1 crypto: marvell/cesa - Fix type mismatch warning
From: Arnd Bergmann <[email protected]>
Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:
In function 'fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' at drivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
583 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is probably harmless as the actual data that is copied has the correct type, but clearly worth fixing nonetheless.
--- drivers/crypto/marvell/cesa/cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/marvell/cesa/cipher.c +1 -1
@@ -297,7 +297,7 @@ static int mv_cesa_des_setkey(struct crypto_skcipher *cipher, const u8 *key,static int mv_cesa_des3_ede_setkey (struct crypto_skcipher *cipher,const u8 *key,unsigned int len) { -struct mv_cesa_des_ctx *ctx =crypto_skcipher_ctx (cipher); +struct mv_cesa_des3_ctx *ctx =crypto_skcipher_ctx (cipher);int err; err =verify_skcipher_des3_key (cipher, key);
Signature · 1 line
2.39.2
Quoted 12 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Commit
df8fc4e934c1("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:In function '
fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' atdrivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines
This is probably harmless as the actual data that is copied has the correct type, but clearly worth fixing nonetheless.
Fixes 4ada48397823 ("crypto: marvell/cesa - add Triple-DES support")Cc Kees Cook <[email protected]>Cc Gustavo A. R. Silva" <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>
Signature · 1 line
Kees Cook
Kees Cook
AppliedQuoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Commit
df8fc4e934c1("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:
Quoted 7 lines
In function '
fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' atdrivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[...]
Applied to for-next/hardening, thanks!
[1/1] crypto: marvell/cesa - Fix type mismatch warning
https://git.kernel.org/kees/c/37f3abddda8d
Signature · 1 line
Kees Cook
Herbert Xu
maintainerQuoted 13 lines · Kees Cook
Quoted 12 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Commit
df8fc4e934c1("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:In function '
fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' atdrivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 1 line
[...]
Applied to for-next/hardening, thanks!
[1/1] crypto: marvell/cesa - Fix type mismatch warning
https://git.kernel.org/kees/c/37f3abddda8d
Why did you apply it to your tree? This patch makes sense on its own regardless of the fortify changes.
Thanks,
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
Quoted 16 lines · Herbert Xu
Quoted 15 lines · Kees Cook
Quoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Commit
df8fc4e934c1("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:In function '
fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' atdrivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[...]
Quoted 7 lines
Quoted 4 lines
Applied to for-next/hardening, thanks!
[1/1] crypto: marvell/cesa - Fix type mismatch warning
https://git.kernel.org/kees/c/37f3abddda8dWhy did you apply it to your tree? This patch makes sense on its own regardless of the fortify changes.
I snagged it since a week had gone by with no additional discussion and it fixed an issue exposed by work in the hardening tree. Let me know if you'd prefer I drop it for you to carry instead.
-Kees
Signature · 1 line
Kees Cook
Herbert Xu
maintainerOn Wed, May 31, 2023 at 09:31:18AM -0700, Kees Cook wrote:
.
Quoted 3 lines
I snagged it since a week had gone by with no additional discussion and it fixed an issue exposed by work in the hardening tree. Let me know if you'd prefer I drop it for you to carry instead.
Yes because these sort of changes cause unnecessary conflicts. It's not as if the patch depends on something in the hardening tree.
Thanks,
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
Quoted 9 lines · Herbert Xu
On Wed, May 31, 2023 at 09:31:18AM -0700, Kees Cook wrote:
.Quoted 3 lines
I snagged it since a week had gone by with no additional discussion and it fixed an issue exposed by work in the hardening tree. Let me know if you'd prefer I drop it for you to carry instead.
Yes because these sort of changes cause unnecessary conflicts. It's not as if the patch depends on something in the hardening tree.
Done! :)
Signature · 1 line
Kees Cook
Herbert Xu
maintainerQuoted 15 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Commit
df8fc4e934c1("kbuild: Enable -fstrict-flex-arrays=3") uncovered a type mismatch in cesa 3des support that leads to a memcpy beyond the end of a structure:In function '
fortify_memcpy_chk',
inlined from 'mv_cesa_des3_ede_setkey' atdrivers/crypto/marvell/cesa/cipher.c:307:2:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~This is probably harmless as the actual data that is copied has the correct type, but clearly worth fixing nonetheless.
Quoted 7 lines
Fixes 4ada48397823 ("crypto: marvell/cesa - add Triple-DES support")Cc Kees Cook <[email protected]>Cc Gustavo A. R. Silva" <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>--- drivers/crypto/marvell/cesa/cipher.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
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