#include #include #include #include #include "rnd.h" #include "die.h" #include "ioexact.h" #include "ioops.h" static int fdw = -1; static void randombytes_weak(unsigned char *x, unsigned long long xlen) { int ret; if (fdw == -1) { for (;;) { fdw = open(LOW_ENTROPY_SOURCE, O_RDONLY); if (fdw != -1) break; sleep(1); } } while (xlen > 0) { if (xlen < 1048576) ret = xlen; else ret = 1048576; ret = read(fdw, x, ret); if (ret < 1) { sleep(1); continue; } x += ret; xlen -= ret; } } static void randombytes_strong(unsigned char *x, unsigned long long xlen) { int fds, ret; fds = open_or_die(HIG_ENTROPY_SOURCE, O_RDONLY); ret = read_exact(fds, x, xlen, 0); if (ret != xlen) panic("Error reading from entropy source!\n"); close(fds); } int secrand(void) { int ret; randombytes_weak((void *) &ret, sizeof(ret)); return ret; } void gen_key_bytes(unsigned char *area, size_t len) { randombytes_strong(area, len); } net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
path: root/net/lapb
/net-next.git/commit/?id=b7a9f420ed737cb7cd4075ba06ac1a6f0da9f878'>root/arch/x86/mm
diff options
AgeCommit message (Expand)AuthorFilesLines
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2013-11-21 14:32:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-21 16:42:27 -0800
commitb7a9f420ed737cb7cd4075ba06ac1a6f0da9f878 (patch)
tree17c9854b57621cf465522177e4d591f2dea01ec3 /arch/x86/mm
parent49204c116a9ee24536d371be02a2f05e6493c949 (diff)
mm, mempolicy: silence gcc warning
Fengguang Wu reports that compiling mm/mempolicy.c results in a warning: mm/mempolicy.c: In function 'mpol_to_str': mm/mempolicy.c:2878:2: error: format not a string literal and no format arguments Kees says this is because he is using -Wformat-security. Silence the warning. Signed-off-by: David Rientjes <rientjes@google.com> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Suggested-by: Kees Cook <keescook@chromium.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm')