[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120609052610.GX30000@ZenIV.linux.org.uk>
Date: Sat, 9 Jun 2012 06:26:10 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Jan Kara <jack@...e.cz>
Cc: Eric Van Hensbergen <ericvh@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: seq_file dangerous assumption?
On Mon, Jun 04, 2012 at 10:07:20PM +0200, Jan Kara wrote:
> Also we don't usually put magics into our data structure just to stop bad
> use of interfaces. I agree that in this particular case the interface is
> easy to get wrong - but that should be solved by changing the interface to
> a more robust one. Actually, I'm not sure if anyone actually passes
> ->private_data != NULL since seq_open_private() seems to be a standard way
> of associating some additional data with seq_file. So maybe
> BUG_ON(file->private_data) would be a good robustification of the interface
> :).
*cough* /proc/mounts *cough*
I've just thrown a cleanup of that shite into #for-next (and posted it
upthread). The bottom line:
* seq_open() is fine with ->private_data pointing to struct seq_file
embedded into something.
* that's a supported use; just use container_of() to get to the
entire object by ->private_data (or similar container_of() by seq_file *
argument in seq_file methods).
--
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