[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJniumU-neufdW_AbrtdF4K+jxnP6OuvA94rSXcE4g+eif29wg@mail.gmail.com>
Date: Mon, 25 Jul 2011 13:45:06 -0700
From: Paul Menage <menage@...gle.com>
To: Wanlong Gao <gaowanlong@...fujitsu.com>
Cc: lizf@...fujitsu.com, axboe@...nel.dk, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup:be able to remove the record of unplugged device
On Sun, Jul 24, 2011 at 11:03 PM, Wanlong Gao <gaowanlong@...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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists