Messages in this thread | | | From | Paul Menage <> | Date | Mon, 25 Jul 2011 13:45:06 -0700 | 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@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/
| |