Commit 9784bd4f authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

s390/vmlogrdr: fix array access in vmlogrdr_open()

Fix check within vmlogrdr_open() if the minor address is not larger
than the number of array elements.

Found with "smatch":

drivers/s390/char/vmlogrdr.c:318 vmlogrdr_open() warn:
  buffer overflow 'sys_ser' 3 <= 3
Acked-by: default avatarStefan Weinhuber <wein@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 0ebfd313
...@@ -313,7 +313,7 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp) ...@@ -313,7 +313,7 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
int ret; int ret;
dev_num = iminor(inode); dev_num = iminor(inode);
if (dev_num > MAXMINOR) if (dev_num >= MAXMINOR)
return -ENODEV; return -ENODEV;
logptr = &sys_ser[dev_num]; logptr = &sys_ser[dev_num];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment