smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: smatch@vger.kernel.org
Subject: uninitialized symbol 'xxxx' is too overzealous?
Date: Thu, 17 May 2018 20:55:04 -0400	[thread overview]
Message-ID: <DA99B5E1-A63D-4B45-B781-62C5714102E6@linuxhacker.ru> (raw)

Hello!

   I just updated to the tip of master for smatch and it seems uninitialized variables detection is way too overzealous.
   While it did find one valid usage, I cannot stop imagining that it basically assumes that if you
   pass a pointer to uninitialized variable somewhere, the variable would remain unitialized at least sometimes.

   E.g. this code:
struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data,
                             __u64 offset, struct ll_dir_chain *chain)
{
        struct md_callback      cb_op;
        struct page             *page;
        int                     rc;

        cb_op.md_blocking_ast = ll_md_blocking_ast;
        rc = md_read_page(ll_i2mdexp(dir), op_data, &cb_op, offset, &page);
        if (rc != 0)
                return ERR_PTR(rc);

        return page;
}

   Produces:
lustre/llite/dir.c:156 ll_get_dir_page() error: uninitialized symbol 'page’.

   I went through everythign down the stack and I cannot see how.

   The actual code could be seen here:
https://git.hpdd.intel.com/?p=fs/lustre-release.git;a=blob;f=lustre/llite/dir.c;h=44b174726677b780f01c4bd252d599deb08ac083;hb=refs/heads/master

   Am I missing something? This is on by default even without —-spammy

   Also is —two-pass supposed to do anything worthwhile? So far the most visible effect is complaining
   how basically every function call return is “unused”.

   Thanks.

Bye,
    Oleg

             reply	other threads:[~2018-05-18  1:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  0:55 Oleg Drokin [this message]
2018-05-25 12:12 ` uninitialized symbol 'xxxx' is too overzealous? Dan Carpenter
2018-05-25 23:43   ` Oleg Drokin
2018-05-25 12:20 ` Dan Carpenter
2018-05-25 23:46   ` Oleg Drokin
2018-05-28  7:45     ` Dan Carpenter

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=DA99B5E1-A63D-4B45-B781-62C5714102E6@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=smatch@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 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 read-only IMAP folder(s) and NNTP newsgroup(s).