All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: CIFS <linux-cifs@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: coverity problems with certain macros
Date: Tue, 22 Jun 2021 18:14:07 -0500	[thread overview]
Message-ID: <CAH2r5muNZdzYOWZrRvo_OKVsmsPnNZckriKDqQTAQ06Wm5PObA@mail.gmail.com> (raw)
In-Reply-To: <CAH2r5mvCOafQpko19fmSTtEdgG7mp2R1+xto=_fkm7A=fqWq5Q@mail.gmail.com>

Also interesting that it appears to show up only in the "linux"
coverity report not the "linux-next" coverity report which have
similar code there.

On Tue, Jun 22, 2021 at 6:11 PM Steve French <smfrench@gmail.com> wrote:
>
> Looks like coverity's scan of the Linux kernel has problems with
> analyzing locks across some debug print macros (which ironically don't
> use any locks related to this component)
>
> e.g. Coverity Linux issues: 1484748, 1484736, 1475751, 1475743 and 1475726
>
> as an example it flags the section of code below, and others with
> calls to "cifs_dbf(VFS, ...) " in them (and note that the debug macros
> don't take a lock) starting with the cifs_dbg(VFS, ...) call.  It
> says:
>
> "May result in deadlock if there is another attempt to acquire the lock.
> In find_cifs_entry: Missing a release of a lock on a path"
>
> Oddly it doesn't flag "cifs_dbg(FYI, ...") calls, and even more
> strangely the calls they flag are simply wrappers around calls to
> "pr_err__ ## ratefunc ..."
>
> See below snippet from fs/cifs/readdir.c e.g.
>
>                         cifs_dbg(VFS, "reached end of buf searching
> for pos in buf %d index to find %lld rc %d\n",
>                                  pos_in_buf, index_to_find, rc);
>                 }
>                 rc = 0;
>                 *current_entry = cur_ent;
>         } else {
>                 cifs_dbg(FYI, "index not in buffer - could not
> findnext into it\n");
>                 return 0;
>         }
>
>         if (pos_in_buf >= cfile->srch_inf.entries_in_buffer) {
>                 cifs_dbg(FYI, "can not return entries pos_in_buf
> beyond last\n");
>                 *num_to_ret = 0;
>         } else
>                 *num_to_ret = cfile->srch_inf.entries_in_buffer - pos_in_buf;
>
>         return rc;
> }
>
> --
> Thanks,
>
> Steve



-- 
Thanks,

Steve

  reply	other threads:[~2021-06-22 23:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 23:11 coverity problems with certain macros Steve French
2021-06-22 23:14 ` Steve French [this message]
2021-06-23 11:42   ` Aurélien Aptel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH2r5muNZdzYOWZrRvo_OKVsmsPnNZckriKDqQTAQ06Wm5PObA@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.