Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752458Ab2BPNcL (ORCPT ); Thu, 16 Feb 2012 08:32:11 -0500 Received: from mail-pz0-f46.google.com ([209.85.210.46]:36364 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752295Ab2BPNcI convert rfc822-to-8bit (ORCPT ); Thu, 16 Feb 2012 08:32:08 -0500 MIME-Version: 1.0 In-Reply-To: <1329393696-4802-2-git-send-email-daniel.vetter@ffwll.ch> References: <1329393696-4802-1-git-send-email-daniel.vetter@ffwll.ch> <1329393696-4802-2-git-send-email-daniel.vetter@ffwll.ch> Date: Thu, 16 Feb 2012 21:32:08 +0800 Message-ID: Subject: Re: [PATCH] mm: extend prefault helpers to fault in more than PAGE_SIZE From: Hillf Danton To: Daniel Vetter Cc: Andrew Morton , Intel Graphics Development , DRI Development , LKML , Linux MM Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 958 Lines: 21 On Thu, Feb 16, 2012 at 8:01 PM, Daniel Vetter wrote: > @@ -416,17 +417,20 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size) >         * Writing zeroes into userspace here is OK, because we know that if >         * the zero gets there, we'll be overwriting it. >         */ > -       ret = __put_user(0, uaddr); > +       while (uaddr <= end) { > +               ret = __put_user(0, uaddr); > +               if (ret != 0) > +                       return ret; > +               uaddr += PAGE_SIZE; > +       } What if uaddr & ~PAGE_MASK == PAGE_SIZE -3 && end & ~PAGE_MASK == 2 -- 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/