[PATCH] coverity: ipmi: avoid overrun of ipmi_interfaces[]
authorZaur Kambarov <kambarov@berkeley.edu>
Wed, 22 Jun 2005 00:14:30 +0000 (17:14 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 22 Jun 2005 01:46:11 +0000 (18:46 -0700)
Fix overrun of static array "ipmi_interfaces" of size 4 at position 4 with
index variable "if_num".

Definitions involved:
297   #define MAX_IPMI_INTERFACES 4
298   static ipmi_smi_t ipmi_interfaces[MAX_IPMI_INTERFACES];

Signed-off-by: Zaur Kambarov <zkambarov@coverity.com>
Cc: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/ipmi/ipmi_msghandler.c

index d7fb452af7f988a4d289acc4f3ebcb0c0bac5efb..0c81652eaba65cc7895cb740a00a4bfdcffbd79f 100644 (file)
@@ -641,7 +641,7 @@ int ipmi_create_user(unsigned int          if_num,
                return -ENOMEM;
 
        down_read(&interfaces_sem);
-       if ((if_num > MAX_IPMI_INTERFACES) || ipmi_interfaces[if_num] == NULL)
+       if ((if_num >= MAX_IPMI_INTERFACES) || ipmi_interfaces[if_num] == NULL)
        {
                rv = -EINVAL;
                goto out_unlock;