linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jan Schmidt <list.btrfs@jan-o-sch.net>
Cc: linux-btrfs@vger.kernel.org
Subject: passing positive numbers to ERR_PTR()
Date: Wed, 8 Feb 2012 12:18:09 +0300	[thread overview]
Message-ID: <20120208085712.GA6554@elgon.mountain> (raw)

Hi Jan,

Smatch complains when you pass positive numbers to ERR_PTR().  There
is a warning triggered in iref_to_path().

fs/btrfs/backref.c +920 iref_to_path()
   918  
   919          if (ret)
   920                  return ERR_PTR(ret);
                                       ^^^
"ret" can be either a negative error code, zero, or one here.

   921  

I looked at the code, but couldn't tell if it was intentional or not.
It really is pretty unusual to do that, so maybe there should be a
comment or something.

regards,
dan carpenter

             reply	other threads:[~2012-02-08  9:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08  9:18 Dan Carpenter [this message]
2012-02-08 15:01 ` [PATCH] Btrfs: avoid positive number with ERR_PTR Jan Schmidt

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=20120208085712.GA6554@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=list.btrfs@jan-o-sch.net \
    /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 NNTP newsgroup(s).