[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080721070346.GA28946@ZenIV.linux.org.uk>
Date: Mon, 21 Jul 2008 08:03:46 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Li Zefan <lizf@...fujitsu.com>
Cc: Cyrill Gorcunov <gorcunov@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfs: use kstrdup()
On Mon, Jul 21, 2008 at 02:29:47PM +0800, Li Zefan wrote:
> > FWIW, it _is_ a good question.
> >
> > * is all code treating ->mnt_devname as optional? AFAICS, there's
> > at least one place in NFS that doesn't. We could treat failing allocation
> > the same way we treat failing allocation of vfsmount itself - callers can
> > cope with that already.
>
> I just did a cleanup, and the original code didn't check for NULL.
I know.
> I just looked into the git history, and I found out since fs/namespace.c was
> created in v2.4.10.4, the code has never changed to check for failing
> allocation of ->mnt_devname.
It used to have no users beyond fs/namespace.c itself and for _those_ the
thing had been optional, so leaving NULL had been OK. Unfortunately, it
still had been a bad idea - new users had appeared and those predictably
didn't notice that fun detail.
The right thing here is to consider failing allocation of ->mnt_devname
as failure of the entire alloc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists