All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto, gf128: fix call to memset()
@ 2011-07-07  8:33 Mathias Krause
  2011-07-07  9:10 ` David Miller
  2011-07-07 11:10 ` pageexec
  0 siblings, 2 replies; 4+ messages in thread
From: Mathias Krause @ 2011-07-07  8:33 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: linux-crypto, Mathias Krause, PaX Team

In gf128mul_lle() and gf128mul_bbe() r isn't completely initialized with
zero because the size argument passed to memset() is the size of the
pointer, not the structure it points to.

Luckily there are no in-kernel users of those functions so the ABI
change implied by this fix should break no existing code.

Based on a patch by the PaX Team.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: PaX Team <pageexec@freemail.hu>
---
 crypto/gf128mul.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/gf128mul.c b/crypto/gf128mul.c
index df35e4c..5276607 100644
--- a/crypto/gf128mul.c
+++ b/crypto/gf128mul.c
@@ -182,7 +182,7 @@ void gf128mul_lle(be128 *r, const be128 *b)
 	for (i = 0; i < 7; ++i)
 		gf128mul_x_lle(&p[i + 1], &p[i]);
 
-	memset(r, 0, sizeof(r));
+	memset(r, 0, sizeof(*r));
 	for (i = 0;;) {
 		u8 ch = ((u8 *)b)[15 - i];
 
@@ -220,7 +220,7 @@ void gf128mul_bbe(be128 *r, const be128 *b)
 	for (i = 0; i < 7; ++i)
 		gf128mul_x_bbe(&p[i + 1], &p[i]);
 
-	memset(r, 0, sizeof(r));
+	memset(r, 0, sizeof(*r));
 	for (i = 0;;) {
 		u8 ch = ((u8 *)b)[i];
 
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto, gf128: fix call to memset()
  2011-07-07  8:33 [PATCH] crypto, gf128: fix call to memset() Mathias Krause
@ 2011-07-07  9:10 ` David Miller
  2011-07-08  9:21   ` Herbert Xu
  2011-07-07 11:10 ` pageexec
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2011-07-07  9:10 UTC (permalink / raw)
  To: minipli; +Cc: herbert, linux-crypto, pageexec

From: Mathias Krause <minipli@googlemail.com>
Date: Thu,  7 Jul 2011 10:33:50 +0200

> In gf128mul_lle() and gf128mul_bbe() r isn't completely initialized with
> zero because the size argument passed to memset() is the size of the
> pointer, not the structure it points to.
> 
> Luckily there are no in-kernel users of those functions so the ABI
> change implied by this fix should break no existing code.
> 
> Based on a patch by the PaX Team.
> 
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: PaX Team <pageexec@freemail.hu>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto, gf128: fix call to memset()
  2011-07-07  8:33 [PATCH] crypto, gf128: fix call to memset() Mathias Krause
  2011-07-07  9:10 ` David Miller
@ 2011-07-07 11:10 ` pageexec
  1 sibling, 0 replies; 4+ messages in thread
From: pageexec @ 2011-07-07 11:10 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Mathias Krause; +Cc: linux-crypto, Mathias Krause

On 7 Jul 2011 at 10:33, Mathias Krause wrote:

> In gf128mul_lle() and gf128mul_bbe() r isn't completely initialized with
> zero because the size argument passed to memset() is the size of the
> pointer, not the structure it points to.
> 
> Luckily there are no in-kernel users of those functions so the ABI
> change implied by this fix should break no existing code.
> 
> Based on a patch by the PaX Team.

just for the record, the bug was pointed out by a recent clang analysis pass.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto, gf128: fix call to memset()
  2011-07-07  9:10 ` David Miller
@ 2011-07-08  9:21   ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2011-07-08  9:21 UTC (permalink / raw)
  To: David Miller; +Cc: minipli, linux-crypto, pageexec

On Thu, Jul 07, 2011 at 02:10:39AM -0700, David Miller wrote:
> From: Mathias Krause <minipli@googlemail.com>
> Date: Thu,  7 Jul 2011 10:33:50 +0200
> 
> > In gf128mul_lle() and gf128mul_bbe() r isn't completely initialized with
> > zero because the size argument passed to memset() is the size of the
> > pointer, not the structure it points to.
> > 
> > Luckily there are no in-kernel users of those functions so the ABI
> > change implied by this fix should break no existing code.
> > 
> > Based on a patch by the PaX Team.
> > 
> > Signed-off-by: Mathias Krause <minipli@googlemail.com>
> > Cc: PaX Team <pageexec@freemail.hu>
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Patch applied.  Thanks a lot!
-- 
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] 4+ messages in thread

end of thread, other threads:[~2011-07-08  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07  8:33 [PATCH] crypto, gf128: fix call to memset() Mathias Krause
2011-07-07  9:10 ` David Miller
2011-07-08  9:21   ` Herbert Xu
2011-07-07 11:10 ` pageexec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.