diff options
author | Ameen Ali <ameenali023@gmail.com> | 2015-02-24 18:41:50 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-02-26 09:24:48 +0100 |
commit | 3a9f9183bdd341a25c7805d96bbd78a31d559381 (patch) | |
tree | b008de43a2c198ea1756e39615d5ae57d93f6f43 /drivers | |
parent | a13ccb04af4aa6632c11d59ddf6555aa80ffb139 (diff) |
s390/dcss: array index 'i' is used before limits check.
Avoid out-of-bounds-read by checking count before indexing.
Signed-off-by : Ameen Ali <Ameenali023@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/s390/block/dcssblk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 96128cb009f3..da212813f2d5 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -547,7 +547,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char * parse input */ num_of_segments = 0; - for (i = 0; ((buf[i] != '\0') && (buf[i] != '\n') && i < count); i++) { + for (i = 0; (i < count && (buf[i] != '\0') && (buf[i] != '\n')); i++) { for (j = i; (buf[j] != ':') && (buf[j] != '\0') && (buf[j] != '\n') && |