Skip to content

Commit

Permalink
[S390] prng: fix pointer arithmetic
Browse files Browse the repository at this point in the history
The git commit c708c57 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>
  • Loading branch information
Martin Schwidefsky authored and Martin Schwidefsky committed Apr 27, 2011
1 parent 8e10cd7 commit ed96158
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/crypto/prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ed96158

Please sign in to comment.