lkml.org 
[lkml]   [2012]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 3.6rc6 slab corruption.
On Wed, Sep 19, 2012 at 2:49 PM, David Rientjes <rientjes@google.com> wrote:
>
> An alternative to this, though, might be to never test for *ppos == 0 in
> u32_array_read() and do the format_array_alloc() in u32_array_open() to
> initialize file->private_data. If that allocation fails, just return
> -ENOMEM. Then you never need to add a mutex in the read path.
>
> Any reason we can't do this?

That does look simpler, and avoiding the lock is a good idea. Since we
don't support lseek() (or pread/pwrite) on that thing anyway, there's
no way to keep the fd open and just re-use it to read the data over
and over, so populating it at open time sounds like a good solution
with no real downsides.

Linus


\
 
 \ /
  Last update: 2012-09-20 01:41    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site