Re: [PATCH] mm: get_user_pages() stores ERR_PTR() in pages[i] on failure

From: Leon Woestenberg
Date: Tue Aug 04 2009 - 07:20:59 EST


Hello Brice,

On Tue, Aug 4, 2009 at 12:39 PM, Brice Goglin<Brice.Goglin@xxxxxxxx> wrote:
>
> Only compile-tested (and not in the nommu case).
>
> @@ -1317,10 +1320,11 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
>                                        FAULT_FLAG_WRITE : 0);
>
>                                if (ret & VM_FAULT_ERROR) {
> -                                       if (ret & VM_FAULT_OOM)
> -                                               return i ? i : -ENOMEM;
> -                                       else if (ret & VM_FAULT_SIGBUS)
> -                                               return i ? i : -EFAULT;
> +                                       if (ret & VM_FAULT_OOM) {
> +                                               err = -ENOMEM;
> +                                               goto abort;
> +                                       } else if (ret & VM_FAULT_SIGBUS)
> +                                               goto abort;

Minor style issue; when the if-block has brackets, the else(if)-block
should also have brackets (even when it's a one-liner on the else
block).

Looks good, I will go ahead and test it (back-port/patched against 2.6.30).

Regards,
--
Leon
èº{.nÇ+?·?®?­?+%?Ëlzwm?éb?맲æìr¸?zX§»®w¥?{ayºÊ?Ú?ë,j­¢f£¢·h??àz¹®w¥¢¸ ¢·¦j:+v?¨?wèjØm¶?ÿ¾«?êçzZ+?ù???Ý¢j"?ú!¶iO?æ¬z·?vØ^¶m§ÿðà nÆ?àþY&?