lkml.org 
[lkml]   [2011]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] pipe: Fail cleanly when root tries F_SETPIPE_SZ with big size
From
On Fri, Nov 18, 2011 at 10:04:34PM +0200, Sasha Levin wrote:
>> +     if (nr_pages * sizeof(struct pipe_buffer) > KMALLOC_MAX_SIZE)
>> +             return -ENOMEM;

On Fri, Nov 18, 2011 at 10:25 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> nr_pages is unsigned long, sizeof is greater than 1, KMALLOC_MAX_SIZE is
> unsigned long...  So write that check as KMALLOC_MAX_SIZE / sizeof > nr_pages

We could just use __GFP_NOWARN here and let kcalloc() deal with the
overflow case.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-11-18 22:07    [W:0.036 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site