Re: [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]

 



On Mon, Jun 30, 2014 at 3:52 PM, David Rientjes <rientjes@xxxxxxxxxx> wrote:
> 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);

If you have the compiler warning still, that's handy to include in the
commit message. Regardless, seems good to me.

Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks!

-Kees

-- 
Kees Cook
Chrome OS Security

--
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]