lkml.org 
[lkml]   [2011]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] cgroup:be able to remove the record of unplugged device
    On Sun, Jul 24, 2011 at 11:03 PM, Wanlong Gao <gaowanlong@cn.fujitsu.com> wrote:
    > @@ -826,15 +826,15 @@ static int blkio_policy_parse_and_set(char *buf,
    >
    >        dev = MKDEV(major, minor);
    >
    > +       if (s[1] == NULL)
    > +               return -EINVAL;
    > +

    How can s[1] be NULL? If there aren't two parameters in the input we'd
    have returned earlier since i!=2, and each element in s[] is
    initialized from a pointer that has been dereference immediately
    beforehand, and hence can't be NULL.

    >        ret = blkio_check_dev_num(dev);
    > -       if (ret)
    > +       if (ret && (strcmp(s[1], "0\0")))
    >                return ret;

    Better to move the parsing of s[1] ahead of this, and do a numerical
    comparison? Otherwise this will miss the case where the input string
    is e.g. "8:0 00"

    Paul
    --
    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-07-25 22:47    [W:3.755 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site