[PATCH] crypto: dont return PTR_ERR() of wrong pointer

2010-12-31 Thread roel kluin
Fix a PTR_ERR() return of the wrong pointer Signed-off-by: Roel Kluin --- drivers/crypto/mv_cesa.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index 7d279e5..c99305a 100644 --- a/drivers/crypto/mv_cesa.c +++ b

[PATCH v3] compiler: prevent dead store elimination

2010-03-03 Thread Roel Kluin
ng a variable, but has been confirmed to work with gcc-3.2.3 up to gcc-4.4.3. Many thanks to Mikael Pettersson and Andi Kleen. Signed-off-by: Roel Kluin --- I used a trick to prevent the assembly for Itanium, defining fake_memory_use in instrinsics.h and checking its definition in string.c, but

[PATCH v2] compiler: prevent dead store elimination

2010-02-28 Thread Roel Kluin
rst byte, via e.g. asm("" :: "m"(*(char*)p)), then the compiler _will_ skip scrubbing bytes beyond the first. This works with gcc-3.2.3 up to gcc-4.4.3. Thanks to Mikael Pettersson for this information. Signed-off-by: Roel Kluin --- > You forgot to credit Mikael Not

[PATCH v1] compiler: prevent dead store elimination

2010-02-27 Thread Roel Kluin
rst byte, via e.g. asm("" :: "m"(*(char*)p)), then the compiler _will_ skip scrubbing bytes beyond the first. This works with gcc-3.2.3 up to gcc-4.4.3. Signed-off-by: Roel Kluin --- include/linux/compiler-gcc.h | 11 +++ include/linux/compiler-intel.h |

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-25 Thread Roel Kluin
> Also from that document: > > If you know how large the accessed memory is, you can add it as input or > output but if this is not known, you should add memory. As an example, if > you access ten bytes of a string, you can use a memory input like: > > {"m"( ({ struct { char x[10]; } *p = (v

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-25 Thread Roel Kluin
Op 25-02-10 18:32, Brian Gerst schreef: > On Thu, Feb 25, 2010 at 12:09 PM, Mikael Pettersson wrote: >> Brian Gerst wrote: >>> Would barrier() (which is a simple memory clobber) after the memset work? >> >> I don't know. It's implemented as an asm with a "memory" clobber, >> but I wouldn't bet on

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-25 Thread roel kluin
On Thu, Feb 25, 2010 at 5:16 PM, Pekka Enberg wrote: > On Thu, Feb 25, 2010 at 5:56 PM, Mikael Pettersson wrote: >> I fear that the only portable (across compiler versions) and safe >> solution is to invoke an assembly-coded dummy function with prototype >> >>        void use(void *p); >> >> and

Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-25 Thread roel kluin
On Thu, Feb 25, 2010 at 4:17 PM, David Miller wrote: > From: Roel Kluin > Date: Thu, 25 Feb 2010 16:10:27 +0100 > >> Due to optimization A call to memset() may be removed as a dead store when >> the buffer is not used after its value is overwritten. >> >> Signed

Re: Is kernel optimized with dead store removal?

2010-02-25 Thread Roel Kluin
> > Does this optimization also occur during compilation of the Linux > > kernel? > Any such dead store removal is up to the compiler and the lifetime > of the object being clobbered. For 'auto' objects the optimization > is certainly likely. > > This is only a problem if the memory (a threa

[PATCH] sha: prevent removal of memset as dead store in sha1_update()

2010-02-25 Thread Roel Kluin
Due to optimization A call to memset() may be removed as a dead store when the buffer is not used after its value is overwritten. Signed-off-by: Roel Kluin --- see http://cwe.mitre.org/data/slices/2000.html#14 checkpatch.pl, compile and sparse tested. Comments? diff --git a/crypto

Is kernel optimized with dead store removal?

2010-02-24 Thread Roel Kluin
According to http://cwe.mitre.org/data/slices/2000.html#14 due to optimization A call to memset() can be removed as a dead store when the buffer is not used after its value is overwritten. Does this optimization also occur during compilation of the Linux kernel? Then I think I may have found some v

Re: [PATCH] geode: Fix cip/blk confusion

2010-01-30 Thread Roel Kluin
a crypto_cipher cip member was set where a crypto_cipher blk members should have been. Signed-off-by: Roel Kluin --- >> I think my previous patch missed one >> blk to cip conversion in geode_setkey_cip(): > > Please send an incremental patch. Thanks! Ok, here's the mis

Re: [PATCH] geode: Fix cip/blk confusion

2010-01-29 Thread roel kluin
On Fri, Jan 29, 2010 at 3:51 PM, Sebastian Andrzej Siewior wrote: > * Roel Kluin | 2010-01-29 14:32:56 [+0100]: > >>This was already discussed in december/januari but I still cannot find it in >>mainline, was it lost? > > Isn't this patch [0] and [1] in Herbert's

[PATCH] geode: Fix cip/blk confusion

2010-01-29 Thread Roel Kluin
crypto_cipher cip members were set where crypto_cipher blk members should have been, also the PTR_ERR of the wrong pointer was returned. Signed-off-by: Roel Kluin --- This was already discussed in december/januari but I still cannot find it in mainline, was it lost? diff --git a/arch/s390

Re: [PATCH] geode: PTR_ERR return of wrong pointer in fallback_init_cip()

2009-12-07 Thread Roel Kluin
Return the PTR_ERR of the correct pointer. Signed-off-by: Roel Kluin --- > This is correct however you missed one spot a few lines above that one. > Sergey Mironov sent a patch a while ago unfortunatelly a mangled one and > he hasn't resent it yet. > Could you please look at [0

[PATCH] geode: PTR_ERR return of wrong pointer in fallback_init_cip()

2009-12-07 Thread Roel Kluin
Return the PTR_ERR of the correct pointer. Signed-off-by: Roel Kluin --- drivers/crypto/geode-aes.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c index 4801162..12cf864 100644 --- a/drivers/crypto/geode-aes.c

Re: [PATCH] crypto: Fix test in get_prng_bytes()

2009-10-12 Thread Roel Kluin
t; Hmm, if it's unneeded why don't we just kill it instead? In that case: -->8--8<- size_t nbytes cannot be less than 0 and the test was redundant. Acked-by: Neil Horman Signed-off-by: Roel Kluin --- diff --

[PATCH] crypto: Fix test in get_prng_bytes()

2009-10-12 Thread Roel Kluin
size_t nbytes cannot be less than 0. Signed-off-by: Roel Kluin --- Or should this test be removed? diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index 3aa6e38..9162456 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c @@ -192,7 +192,7 @@ static int get_prng_bytes(char *buf

[PATCH] crypto: Write outside array bounds

2009-07-28 Thread Roel Kluin
In crypto_aes_expand_key() loop8(i) writes up to ctx->key_enc[8*i+15], at most 63. ctx->key_enc has length (15*16)/4 == 60, so the last 16 bytes of key_enc will overflow into ctx->key_dec. Signed-off-by: Roel Kluin --- Found with Parfait, http://research.sun.com/projects/parfait/ This