lkml.org 
[lkml]   [2011]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/3] pids: Make alloc_pid return error
    On 11/10, Pavel Emelyanov wrote:
    >
    > @@ -281,7 +281,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)
    > {
    > struct pid *pid;
    > enum pid_type type;
    > - int i, nr;
    > + int i, nr = -ENOMEM;
    > struct pid_namespace *tmp;
    > struct upid *upid;

    This doesn't look right at first glance... I mean, if
    the first kmem_cache_alloc(ns->pid_cachep) fails, this -ENOMEM
    won't be returned as ERR_PTR().

    > @@ -321,7 +321,7 @@ out_free:
    > free_pidmap(pid->numbers + i);
    >
    > kmem_cache_free(ns->pid_cachep, pid);
    > - pid = NULL;
    > + pid = ERR_PTR(nr);
    > goto out;

    Off-topic, but with or withoit this patch this "goto out" looks
    strange imho. Why not a simple

    - pid = NULL;
    - goto out;
    + return ERR_PTR(nr);

    instead? But this is minor and subjective, I won't insist.

    Oleg.



    \
     
     \ /
      Last update: 2011-11-10 19:07    [W:0.022 / U:123.064 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site