From: Martin Schwidefsky <schwidefsky@de.ibm.com>
Date: Wed, 27 Apr 2011 07:34:33 +0000 (+0200)
Subject: [S390] prng: fix pointer arithmetic
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ed961581a7ca91d6a4852af2e44333e983100505;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

[S390] prng: fix pointer arithmetic

The git commit c708c57e247775928b9a6bce7b4d8d14883bf39b fixed the
access beyond the end of the stack in prng_seed but the pointer
arithmetic is still incorrect. The calculation has been off by
a factor of 64, now it is only off by a factor of 8. prng_seed
is called with a maximum of 16 for nbytes, small enough that
the incorrect calculation stays insides the limits of the stack.
Place parentheses for correct pointer arithmetic.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 44bca3f994b0..8b16c479585b 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -76,7 +76,7 @@ static void prng_seed(int nbytes)
 
 	/* Add the entropy */
 	while (nbytes >= 8) {
-		*((__u64 *)parm_block) ^= *((__u64 *)buf+i);
+		*((__u64 *)parm_block) ^= *((__u64 *)(buf+i));
 		prng_add_entropy();
 		i += 8;
 		nbytes -= 8;