Skip to content

Commit 7c3a8a1

Browse files
committed
random: use proper return types on get_random_{int,long}_wait()
Before these were returning signed values, but the API is intended to be used with unsigned values. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 7782cfe commit 7c3a8a1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/linux/random.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ static inline int get_random_bytes_wait(void *buf, size_t nbytes)
9090
return ret;
9191
}
9292

93-
#define declare_get_random_var_wait(var) \
94-
static inline int get_random_ ## var ## _wait(var *out) { \
93+
#define declare_get_random_var_wait(name, ret_type) \
94+
static inline int get_random_ ## name ## _wait(ret_type *out) { \
9595
int ret = wait_for_random_bytes(); \
9696
if (unlikely(ret)) \
9797
return ret; \
98-
*out = get_random_ ## var(); \
98+
*out = get_random_ ## name(); \
9999
return 0; \
100100
}
101-
declare_get_random_var_wait(u32)
102-
declare_get_random_var_wait(u64)
103-
declare_get_random_var_wait(int)
104-
declare_get_random_var_wait(long)
101+
declare_get_random_var_wait(u32, u32)
102+
declare_get_random_var_wait(u64, u32)
103+
declare_get_random_var_wait(int, unsigned int)
104+
declare_get_random_var_wait(long, unsigned long)
105105
#undef declare_get_random_var
106106

107107
/*

0 commit comments

Comments
 (0)