All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <clm@fb.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Josef Bacik <jbacik@fb.com>,
	linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] Btrfs: kfree()ing ERR_PTRs
Date: Thu, 04 Sep 2014 12:48:30 +0000	[thread overview]
Message-ID: <54085F9E.80206@fb.com> (raw)
In-Reply-To: <20140904110915.GB21504@mwanda>



On 09/04/2014 07:09 AM, Dan Carpenter wrote:
> The "inherit" in btrfs_ioctl_snap_create_v2() and "vol_args" in
> btrfs_ioctl_rm_dev() are ERR_PTRs so we can't call kfree() on them.
> 
> These kind of bugs are "One Err Bugs" where there is just one error
> label that does everything.  I could set the "inherit = NULL" and keep
> the single out label but it ends up being more complicated that way.  It
> makes the code simpler to re-order the unwind so it's in the mirror
> order of the allocation and introduce some new error labels.

Thanks Dan, agreed on the unwinding.

-chris

WARNING: multiple messages have this Message-ID (diff)
From: Chris Mason <clm@fb.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Josef Bacik <jbacik@fb.com>, <linux-btrfs@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
Subject: Re: [patch] Btrfs: kfree()ing ERR_PTRs
Date: Thu, 4 Sep 2014 08:48:30 -0400	[thread overview]
Message-ID: <54085F9E.80206@fb.com> (raw)
In-Reply-To: <20140904110915.GB21504@mwanda>



On 09/04/2014 07:09 AM, Dan Carpenter wrote:
> The "inherit" in btrfs_ioctl_snap_create_v2() and "vol_args" in
> btrfs_ioctl_rm_dev() are ERR_PTRs so we can't call kfree() on them.
> 
> These kind of bugs are "One Err Bugs" where there is just one error
> label that does everything.  I could set the "inherit = NULL" and keep
> the single out label but it ends up being more complicated that way.  It
> makes the code simpler to re-order the unwind so it's in the mirror
> order of the allocation and introduce some new error labels.

Thanks Dan, agreed on the unwinding.

-chris

  parent reply	other threads:[~2014-09-04 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 11:09 [patch] Btrfs: kfree()ing ERR_PTRs Dan Carpenter
2014-09-04 11:09 ` Dan Carpenter
2014-09-04 12:11 ` walter harms
2014-09-04 12:11   ` walter harms
2014-09-04 12:23   ` Dan Carpenter
2014-09-04 12:23     ` Dan Carpenter
2014-09-04 12:48 ` Chris Mason [this message]
2014-09-04 12:48   ` Chris Mason

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=54085F9E.80206@fb.com \
    --to=clm@fb.com \
    --cc=dan.carpenter@oracle.com \
    --cc=jbacik@fb.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@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.