[patch] binfmt_elf.c: use get_random_int() to fix entropy depleting fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The type of size_t on am33 is unsigned int for gcc major versions >= 4.

Reported-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>
Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
---
 fs/binfmt_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -155,7 +155,7 @@ static void get_atrandom_bytes(unsigned char *buf, size_t nbytes)
 
 	while (nbytes) {
 		unsigned int random_variable;
-		size_t chunk = min(nbytes, sizeof(random_variable));
+		size_t chunk = min(nbytes, (size_t)sizeof(random_variable));
 
 		random_variable = get_random_int();
 		memcpy(p, &random_variable, chunk);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]