From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: Re: [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set()
Date: Mon, 13 Feb 2012 20:17:15 +0000 [thread overview]
Message-ID: <4F396FCB.6060506@oracle.com> (raw)
In-Reply-To: <20120213200835.GK4141@mwanda>
On 02/13/2012 12:08 PM, Dan Carpenter wrote:
> On Mon, Feb 13, 2012 at 11:39:27AM -0800, Sunil Mushran wrote:
>> hmm... I would say NAK because config_group_item_type_name() could
>> change in the future. And there is nothing wrong with the current
>> code.
>
> The error handling isn't correct because checking "&hs->hs_group"
> for NULL doesn't work. "hs" and "&hs->hs_group" are the same
> address and we checked "hs" already. If we wanted to check for
> allocation errors, then we would need to change the check to:
>
> if (!hs->hs_group.cg_item.ci_name)
> kfree(hs);
>
> But that's not how the function is supposed to be used. The example
> code in Documentation/filesystems/configfs/configfs_example_explicit.c
> doesn't have error handling.
True. The error handling is not ideal but only so because it
has not been specified. A better fix would be to first clarify that
in config_group_item_type_name().
WARNING: multiple messages have this Message-ID (diff)
From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set()
Date: Mon, 13 Feb 2012 12:17:15 -0800 [thread overview]
Message-ID: <4F396FCB.6060506@oracle.com> (raw)
In-Reply-To: <20120213200835.GK4141@mwanda>
On 02/13/2012 12:08 PM, Dan Carpenter wrote:
> On Mon, Feb 13, 2012 at 11:39:27AM -0800, Sunil Mushran wrote:
>> hmm... I would say NAK because config_group_item_type_name() could
>> change in the future. And there is nothing wrong with the current
>> code.
>
> The error handling isn't correct because checking "&hs->hs_group"
> for NULL doesn't work. "hs" and "&hs->hs_group" are the same
> address and we checked "hs" already. If we wanted to check for
> allocation errors, then we would need to change the check to:
>
> if (!hs->hs_group.cg_item.ci_name)
> kfree(hs);
>
> But that's not how the function is supposed to be used. The example
> code in Documentation/filesystems/configfs/configfs_example_explicit.c
> doesn't have error handling.
True. The error handling is not ideal but only so because it
has not been specified. A better fix would be to first clarify that
in config_group_item_type_name().
next prev parent reply other threads:[~2012-02-13 20:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-13 13:50 [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set() Dan Carpenter
2012-02-13 13:50 ` [Ocfs2-devel] " Dan Carpenter
2012-02-13 19:39 ` Sunil Mushran
2012-02-13 19:39 ` [Ocfs2-devel] " Sunil Mushran
2012-02-13 20:06 ` Dan Carpenter
2012-02-13 20:08 ` Dan Carpenter
2012-02-13 20:17 ` Sunil Mushran [this message]
2012-02-13 20:17 ` [Ocfs2-devel] " Sunil Mushran
2012-04-17 21:13 ` [Ocfs2-devel] Ocfs2 + Quota! Marek Królikowski
2012-02-13 20:04 ` [patch] ocfs2: cleanup error handling in o2hb_alloc_hb_set() Joel Becker
2012-02-13 20:04 ` [Ocfs2-devel] " Joel Becker
2012-02-13 20:27 ` Dan Carpenter
2012-02-13 20:29 ` Dan Carpenter
2012-02-13 20:41 ` Sunil Mushran
2012-02-13 20:41 ` [Ocfs2-devel] " Sunil Mushran
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=4F396FCB.6060506@oracle.com \
--to=sunil.mushran@oracle.com \
--cc=ocfs2-devel@oss.oracle.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.