Commit 3a845099 authored by Zaur Kambarov's avatar Zaur Kambarov Committed by Linus Torvalds

[PATCH] coverity: ipmi: avoid overrun of ipmi_interfaces[]

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: default avatarZaur Kambarov <zkambarov@coverity.com>
Cc: Corey Minyard <minyard@acm.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7f20b6a4
...@@ -641,7 +641,7 @@ int ipmi_create_user(unsigned int if_num, ...@@ -641,7 +641,7 @@ int ipmi_create_user(unsigned int if_num,
return -ENOMEM; return -ENOMEM;
down_read(&interfaces_sem); 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; rv = -EINVAL;
goto out_unlock; goto out_unlock;
......
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