Skip to content

Commit 8deed84

Browse files
YueHaibingarndb
authored andcommitted
hwrng: Fix unsigned comparison with less than zero
The return from the call to tee_client_invoke_func can be a negative error code however this is being assigned to an unsigned variable 'ret' hence the check is always false. Fix this by making 'ret' an int. Detected by Coccinelle ("Unsigned expression compared with zero: ret < 0") Fixes: 5fe8b1c ("hwrng: add OP-TEE based rng driver") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent bb342f0 commit 8deed84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/char/hw_random/optee-rng.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct optee_rng_private {
7373
static size_t get_optee_rng_data(struct optee_rng_private *pvt_data,
7474
void *buf, size_t req_size)
7575
{
76-
u32 ret = 0;
76+
int ret = 0;
7777
u8 *rng_data = NULL;
7878
size_t rng_size = 0;
7979
struct tee_ioctl_invoke_arg inv_arg;
@@ -175,7 +175,7 @@ static struct optee_rng_private pvt_data = {
175175

176176
static int get_optee_rng_info(struct device *dev)
177177
{
178-
u32 ret = 0;
178+
int ret = 0;
179179
struct tee_ioctl_invoke_arg inv_arg;
180180
struct tee_param param[4];
181181

0 commit comments

Comments
 (0)