提交 6bdc3149 编写于 作者: Z Zheng Zengkai

random: Fix kabi change of get_random_bytes()

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L6BB
CVE: NA

--------------------------------------

Commit 07280d2c3f33 ("random: make more consistent use of integer types")
change the type of parameter nbytes from int to size_t, which break kabi
compatibility.
Separately revert the relate modifications of get_random_bytes() to fix
kabi change.
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NGUO Zihua <guozihua@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 063522ef
...@@ -205,7 +205,7 @@ static void __cold process_random_ready_list(void) ...@@ -205,7 +205,7 @@ static void __cold process_random_ready_list(void)
* *
* There are a few exported interfaces for use by other drivers: * There are a few exported interfaces for use by other drivers:
* *
* void get_random_bytes(void *buf, size_t len) * void get_random_bytes(void *buf, int len)
* u32 get_random_u32() * u32 get_random_u32()
* u64 get_random_u64() * u64 get_random_u64()
* unsigned int get_random_int() * unsigned int get_random_int()
...@@ -442,10 +442,10 @@ static void _get_random_bytes(void *buf, size_t len) ...@@ -442,10 +442,10 @@ static void _get_random_bytes(void *buf, size_t len)
* wait_for_random_bytes() should be called and return 0 at least once * wait_for_random_bytes() should be called and return 0 at least once
* at any point prior. * at any point prior.
*/ */
void get_random_bytes(void *buf, size_t len) void get_random_bytes(void *buf, int len)
{ {
warn_unseeded_randomness(); warn_unseeded_randomness();
_get_random_bytes(buf, len); _get_random_bytes(buf, (size_t) len);
} }
EXPORT_SYMBOL(get_random_bytes); EXPORT_SYMBOL(get_random_bytes);
......
...@@ -28,7 +28,7 @@ static inline void add_latent_entropy(void) ...@@ -28,7 +28,7 @@ static inline void add_latent_entropy(void)
static inline void add_latent_entropy(void) { } static inline void add_latent_entropy(void) { }
#endif #endif
void get_random_bytes(void *buf, size_t len); void get_random_bytes(void *buf, int len);
size_t __must_check get_random_bytes_arch(void *buf, size_t len); size_t __must_check get_random_bytes_arch(void *buf, size_t len);
u32 get_random_u32(void); u32 get_random_u32(void);
u64 get_random_u64(void); u64 get_random_u64(void);
...@@ -75,7 +75,7 @@ int unregister_random_ready_notifier(struct notifier_block *nb); ...@@ -75,7 +75,7 @@ int unregister_random_ready_notifier(struct notifier_block *nb);
static inline int get_random_bytes_wait(void *buf, size_t nbytes) static inline int get_random_bytes_wait(void *buf, size_t nbytes)
{ {
int ret = wait_for_random_bytes(); int ret = wait_for_random_bytes();
get_random_bytes(buf, nbytes); get_random_bytes(buf, (int) nbytes);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册