All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: Ilya Dryomov <idryomov@gmail.com>,
	Ceph Development <ceph-devel@vger.kernel.org>,
	Sage Weil <sage@redhat.com>
Subject: Re: [PATCH 1/2] ceph: have ceph_mdsc_free_path ignore ERR_PTR values
Date: Mon, 13 Apr 2020 22:41:53 +0300	[thread overview]
Message-ID: <20200413194153.GD14511@kadam> (raw)
In-Reply-To: <55c47d66b579fcf5749376c73d681d0273095f6d.camel@kernel.org>

On Mon, Apr 13, 2020 at 09:23:22AM -0400, Jeff Layton wrote:
> > > I don't see a problem with having a "free" routine ignore IS_ERR values
> > > just like it does NULL values. How about I just trim off the other
> > > deltas in this patch? Something like this?
> > 
> > I think it encourages fragile code.  Less so than functions that
> > return pointer, NULL or IS_ERR pointer, but still.  You yourself
> > almost fell into one of these traps while editing debugfs.c ;)
> > 
> 
> We'll have to agree to disagree here. Having a free routine ignore
> ERR_PTR values seems perfectly reasonable to me.

Freeing things which haven't been allocated is a constant source bugs.

err:
	kfree(foo->bar);
	kfree(foo);

Oops...  "foo" wasn't allocated so the first line will crash.  Every
other day someone commits code like that.

regards,
dan carpenter

  parent reply	other threads:[~2020-04-13 19:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 14:21 [PATCH 0/2] ceph: fix error handling bugs in async dirops callbacks Jeff Layton
2020-04-08 14:21 ` [PATCH 1/2] ceph: have ceph_mdsc_free_path ignore ERR_PTR values Jeff Layton
2020-04-13  8:09   ` Ilya Dryomov
2020-04-13 11:15     ` Jeff Layton
2020-04-13 12:35       ` Ilya Dryomov
2020-04-13 13:23         ` Jeff Layton
2020-04-13 15:48           ` Ilya Dryomov
2020-04-13 16:03             ` Jeff Layton
2020-04-13 19:41           ` Dan Carpenter [this message]
2020-04-14 10:43             ` Jeff Layton
2020-04-08 14:21 ` [PATCH 2/2] ceph: initialize base and pathlen variables in async dirops cb's Jeff Layton

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=20200413194153.GD14511@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=sage@redhat.com \
    /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.