[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110613210212.GA2246@thunk.org>
Date: Mon, 13 Jun 2011 17:02:12 -0400
From: Ted Ts'o <tytso@....edu>
To: Lukas Czerner <lczerner@...hat.com>
Cc: Shaohua Li <shaohua.li@...el.com>,
Eric Sandeen <sandeen@...hat.com>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
Subject: Re: [patch]check NULL pointer
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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists