* [PATCH 4.9] ion: Make user_ion_handle_put_nolock() a void function
@ 2022-07-27 16:46 Nathan Chancellor
2022-08-01 8:54 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2022-07-27 16:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: Daniel Rosenberg, stable, llvm, Nathan Chancellor, kernel test robot
Clang warns:
drivers/staging/android/ion/ion-ioctl.c:71:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (--handle->user_ref_count == 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/android/ion/ion-ioctl.c:74:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/android/ion/ion-ioctl.c:71:2: note: remove the 'if' if its condition is always true
if (--handle->user_ref_count == 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/android/ion/ion-ioctl.c:69:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
The return value of user_ion_handle_put_nolock() is not checked in its
one call site in user_ion_free_nolock() so just make
user_ion_handle_put_nolock() return void to remove the warning.
Fixes: a8200613c8c9 ("ion: Protect kref from userspace manipulation")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/staging/android/ion/ion-ioctl.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
index a27865b94416..e020a23d05f2 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -64,14 +64,10 @@ static struct ion_handle *pass_to_user(struct ion_handle *handle)
}
/* Must hold the client lock */
-static int user_ion_handle_put_nolock(struct ion_handle *handle)
+static void user_ion_handle_put_nolock(struct ion_handle *handle)
{
- int ret;
-
if (--handle->user_ref_count == 0)
- ret = ion_handle_put_nolock(handle);
-
- return ret;
+ ion_handle_put_nolock(handle);
}
static void user_ion_free_nolock(struct ion_client *client,
base-commit: 65be5f5665a580424a7b1102f1a04c4259c559b5
--
2.37.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 4.9] ion: Make user_ion_handle_put_nolock() a void function
2022-07-27 16:46 [PATCH 4.9] ion: Make user_ion_handle_put_nolock() a void function Nathan Chancellor
@ 2022-08-01 8:54 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2022-08-01 8:54 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Sasha Levin, Daniel Rosenberg, stable, llvm, kernel test robot
On Wed, Jul 27, 2022 at 09:46:17AM -0700, Nathan Chancellor wrote:
> Clang warns:
>
> drivers/staging/android/ion/ion-ioctl.c:71:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> if (--handle->user_ref_count == 0)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/staging/android/ion/ion-ioctl.c:74:9: note: uninitialized use occurs here
> return ret;
> ^~~
> drivers/staging/android/ion/ion-ioctl.c:71:2: note: remove the 'if' if its condition is always true
> if (--handle->user_ref_count == 0)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/staging/android/ion/ion-ioctl.c:69:9: note: initialize the variable 'ret' to silence this warning
> int ret;
> ^
> = 0
> 1 warning generated.
>
> The return value of user_ion_handle_put_nolock() is not checked in its
> one call site in user_ion_free_nolock() so just make
> user_ion_handle_put_nolock() return void to remove the warning.
>
> Fixes: a8200613c8c9 ("ion: Protect kref from userspace manipulation")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/staging/android/ion/ion-ioctl.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-01 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 16:46 [PATCH 4.9] ion: Make user_ion_handle_put_nolock() a void function Nathan Chancellor
2022-08-01 8:54 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).