* [PATCH] crypto: marvell/cesa - Fix type mismatch warning
@ 2023-05-23 8:33 Arnd Bergmann
2023-05-23 17:04 ` Kees Cook
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Arnd Bergmann @ 2023-05-23 8:33 UTC (permalink / raw)
To: Boris Brezillon, Arnaud Ebalard, Srujana Challa, Herbert Xu,
David S. Miller
Cc: Arnd Bergmann, Kees Cook, linux-crypto, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
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.
Fixes: 4ada48397823 ("crypto: marvell/cesa - add Triple-DES support")
Cc: Kees Cook <keescook@chromium.org>
Cc: Gustavo A. R. Silva" <gustavoars@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/crypto/marvell/cesa/cipher.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/marvell/cesa/cipher.c b/drivers/crypto/marvell/cesa/cipher.c
index c6f2fa753b7c..0f37dfd42d85 100644
--- a/drivers/crypto/marvell/cesa/cipher.c
+++ b/drivers/crypto/marvell/cesa/cipher.c
@@ -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);
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-05-23 8:33 [PATCH] crypto: marvell/cesa - Fix type mismatch warning Arnd Bergmann
@ 2023-05-23 17:04 ` Kees Cook
2023-05-30 22:48 ` Kees Cook
2023-06-02 10:23 ` Herbert Xu
2 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2023-05-23 17:04 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Boris Brezillon, Arnaud Ebalard, Srujana Challa, Herbert Xu,
David S. Miller, Arnd Bergmann, linux-crypto, linux-kernel
On Tue, May 23, 2023 at 10:33:04AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Fixes: 4ada48397823 ("crypto: marvell/cesa - add Triple-DES support")
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Gustavo A. R. Silva" <gustavoars@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-05-23 8:33 [PATCH] crypto: marvell/cesa - Fix type mismatch warning Arnd Bergmann
2023-05-23 17:04 ` Kees Cook
@ 2023-05-30 22:48 ` Kees Cook
2023-05-31 10:58 ` Herbert Xu
2023-06-02 10:23 ` Herbert Xu
2 siblings, 1 reply; 8+ messages in thread
From: Kees Cook @ 2023-05-30 22:48 UTC (permalink / raw)
To: arno, arnd, schalla, Herbert Xu, bbrezillon, davem
Cc: Kees Cook, linux-kernel, Arnd Bergmann, linux-crypto
On Tue, 23 May 2023 10:33:04 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> [...]
Applied to for-next/hardening, thanks!
[1/1] crypto: marvell/cesa - Fix type mismatch warning
https://git.kernel.org/kees/c/37f3abddda8d
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-05-30 22:48 ` Kees Cook
@ 2023-05-31 10:58 ` Herbert Xu
2023-05-31 16:31 ` Kees Cook
0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2023-05-31 10:58 UTC (permalink / raw)
To: Kees Cook
Cc: arno, arnd, schalla, bbrezillon, davem, linux-kernel,
Arnd Bergmann, linux-crypto
On Tue, May 30, 2023 at 03:48:49PM -0700, Kees Cook wrote:
> On Tue, 23 May 2023 10:33:04 +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > 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);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > [...]
>
> 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,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-05-31 10:58 ` Herbert Xu
@ 2023-05-31 16:31 ` Kees Cook
2023-06-01 10:18 ` Herbert Xu
0 siblings, 1 reply; 8+ messages in thread
From: Kees Cook @ 2023-05-31 16:31 UTC (permalink / raw)
To: Herbert Xu
Cc: arno, arnd, schalla, bbrezillon, davem, linux-kernel,
Arnd Bergmann, linux-crypto
On Wed, May 31, 2023 at 06:58:10PM +0800, Herbert Xu wrote:
> On Tue, May 30, 2023 at 03:48:49PM -0700, Kees Cook wrote:
> > On Tue, 23 May 2023 10:33:04 +0200, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > >
> > > 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);
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >
> > > [...]
> >
> > 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.
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
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-05-31 16:31 ` Kees Cook
@ 2023-06-01 10:18 ` Herbert Xu
2023-06-01 14:09 ` Kees Cook
0 siblings, 1 reply; 8+ messages in thread
From: Herbert Xu @ 2023-06-01 10:18 UTC (permalink / raw)
To: Kees Cook
Cc: arno, arnd, schalla, bbrezillon, davem, linux-kernel,
Arnd Bergmann, linux-crypto
On Wed, May 31, 2023 at 09:31:18AM -0700, Kees Cook wrote:
.
> 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,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-06-01 10:18 ` Herbert Xu
@ 2023-06-01 14:09 ` Kees Cook
0 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2023-06-01 14:09 UTC (permalink / raw)
To: Herbert Xu
Cc: arno, arnd, schalla, bbrezillon, davem, linux-kernel,
Arnd Bergmann, linux-crypto
On Thu, Jun 01, 2023 at 06:18:37PM +0800, Herbert Xu wrote:
> On Wed, May 31, 2023 at 09:31:18AM -0700, Kees Cook wrote:
> .
> > 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! :)
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] crypto: marvell/cesa - Fix type mismatch warning
2023-05-23 8:33 [PATCH] crypto: marvell/cesa - Fix type mismatch warning Arnd Bergmann
2023-05-23 17:04 ` Kees Cook
2023-05-30 22:48 ` Kees Cook
@ 2023-06-02 10:23 ` Herbert Xu
2 siblings, 0 replies; 8+ messages in thread
From: Herbert Xu @ 2023-06-02 10:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Boris Brezillon, Arnaud Ebalard, Srujana Challa, David S. Miller,
Arnd Bergmann, Kees Cook, linux-crypto, linux-kernel
On Tue, May 23, 2023 at 10:33:04AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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.
>
> Fixes: 4ada48397823 ("crypto: marvell/cesa - add Triple-DES support")
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Gustavo A. R. Silva" <gustavoars@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/crypto/marvell/cesa/cipher.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-06-02 10:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 8:33 [PATCH] crypto: marvell/cesa - Fix type mismatch warning Arnd Bergmann
2023-05-23 17:04 ` Kees Cook
2023-05-30 22:48 ` Kees Cook
2023-05-31 10:58 ` Herbert Xu
2023-05-31 16:31 ` Kees Cook
2023-06-01 10:18 ` Herbert Xu
2023-06-01 14:09 ` Kees Cook
2023-06-02 10:23 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).