From: Ted Ts'o <tytso@mit.edu>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Shaohua Li <shaohua.li@intel.com>,
Eric Sandeen <sandeen@redhat.com>,
"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [patch]check NULL pointer
Date: Mon, 13 Jun 2011 17:02:12 -0400 [thread overview]
Message-ID: <20110613210212.GA2246@thunk.org> (raw)
In-Reply-To: <alpine.LFD.2.00.1106131116270.4328@dhcp-27-109.brq.redhat.com>
On Mon, Jun 13, 2011 at 11:20:17AM +0200, Lukas Czerner wrote:
> > ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. "
> > "Opts: %s%s%s", descr, sbi->s_es->s_mount_opts,
> > - *sbi->s_es->s_mount_opts ? "; " : "", orig_data);
> > + *sbi->s_es->s_mount_opts ? "; " : "", orig_data ? : ";");
>
> Hi,
>
> so you are trying resolve the problem when the allocation fails right ?
> But what you do is not solving anything, but rather hiding it and it is
> not different than we had before.
So a couple of observations here. The kernel's sprintf/printk
functions will not OOPS if "%s" is asked to expand a NULL pointer; it
will simply print "(null)". So it's not a disaster if orig_data is
NULL. It's would perhaps be better (for cosmetic reasons) if we
printed something such as "Opts: (none)", but it's not a huge deal
either way.
> So what about this:
>
> if (data && !orig_data)
> return ret;
Sure, that's technically better. I'll note though that if we fail the
kstrdup(), there are so many other memory allocations happening later
in ext4_fill_super() that it's highly likely one of the others will
fail and we will then return ENOMEM.
That's not to say that patches here aren't welcome, but (a) it's
useful to take a look at the big picture, and (b) I'm going to
prioritize this as a "clean up" patch that can wait until the merge
window for v3.1. It will be a great opportunity for Shaohua to
practice submitting a high quality patch that complies with the
Documentation/SubmittingPatches requirements.
Regards,
- Ted
next prev parent reply other threads:[~2011-06-14 3:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 3:31 [patch]check NULL pointer Shaohua Li
2011-06-09 9:24 ` Lukas Czerner
2011-06-09 14:51 ` Eric Sandeen
2011-06-10 6:34 ` Shaohua Li
2011-06-10 8:32 ` Lukas Czerner
2011-06-13 7:30 ` Shaohua Li
2011-06-13 9:20 ` Lukas Czerner
2011-06-13 21:02 ` Ted Ts'o [this message]
2011-06-14 0:31 ` Shaohua Li
2011-06-14 10:07 ` Lukas Czerner
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=20110613210212.GA2246@thunk.org \
--to=tytso@mit.edu \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=shaohua.li@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox