浏览代码

[PATCH] Overrun in cdrom/aztcd.c

This fixes coverity bug id #473.  After the for loop i==16 if we didn't find a
cdrom.  So we should check for i==16 first before checking the array element.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Eric Sesterhenn 19 年之前
父节点
当前提交
d93c2efc93
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/cdrom/aztcd.c

+ 1 - 1
drivers/cdrom/aztcd.c

@@ -1763,7 +1763,7 @@ static int __init aztcd_init(void)
 				release_region(azt_port, 4);
 			}
 		}
-		if ((azt_port_auto[i] == 0) || (i == 16)) {
+		if ((i == 16) || (azt_port_auto[i] == 0)) {
 			printk(KERN_INFO "aztcd: no AZTECH CD-ROM drive found\n");
 			return -EIO;
 		}