lkml.org 
[lkml]   [2021]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] binder: fixed coverity warning by moving pr_warn outside lock
On Sat, Dec 04, 2021 at 01:50:41AM +0500, Ameer Hamza wrote:
> Coverity warns about using print operations within a lock due to
> unlikely possible deadlock scenario, however, this warning can be
> easily avoided here without having any effect on the program flow.
>
> Addresses-Coverity: 1494148 ("Thread deadlock")

Sounds like coverity is wrong, you can print any time, locks do not
matter here.

Do you have a link to the exact coverity report for this?

> Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
> ---
> drivers/android/binder.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index cffbe57a8e08..8ee942eef51d 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -1507,14 +1507,14 @@ static void binder_free_transaction(struct binder_transaction *t)
> if (target_proc) {
> binder_inner_proc_lock(target_proc);
> target_proc->outstanding_txns--;
> - if (target_proc->outstanding_txns < 0)
> - pr_warn("%s: Unexpected outstanding_txns %d\n",
> - __func__, target_proc->outstanding_txns);
> if (!target_proc->outstanding_txns && target_proc->is_frozen)
> wake_up_interruptible_all(&target_proc->freeze_wait);
> if (t->buffer)
> t->buffer->transaction = NULL;
> binder_inner_proc_unlock(target_proc);
> + if (target_proc->outstanding_txns < 0)
> + pr_warn("%s: Unexpected outstanding_txns %d\n",
> + __func__, target_proc->outstanding_txns);

Have you seen problems with the location of the existing message? If
not, this should be fine.

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-12-04 08:58    [W:0.058 / U:1.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site