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: Zheng Zengkai zhengzengkai@huawei.com Reviewed-by: GUO Zihua guozihua@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Acked-by: Xie XiuQi xiexiuqi@huawei.com --- drivers/char/random.c | 6 +++--- include/linux/random.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/char/random.c b/drivers/char/random.c index 00b50ccc9fae..04a7b401736b 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -205,7 +205,7 @@ static void __cold process_random_ready_list(void) * * 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() * u64 get_random_u64() * unsigned int get_random_int() @@ -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 * at any point prior. */ -void get_random_bytes(void *buf, size_t len) +void get_random_bytes(void *buf, int len) { warn_unseeded_randomness(); - _get_random_bytes(buf, len); + _get_random_bytes(buf, (size_t) len); } EXPORT_SYMBOL(get_random_bytes);
diff --git a/include/linux/random.h b/include/linux/random.h index 917470c4490a..7b374cc82cb3 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -28,7 +28,7 @@ static inline void add_latent_entropy(void) static inline void add_latent_entropy(void) { } #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); u32 get_random_u32(void); u64 get_random_u64(void); @@ -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) { int ret = wait_for_random_bytes(); - get_random_bytes(buf, nbytes); + get_random_bytes(buf, (int) nbytes); return ret; }