提交 43477d2b 编写于 作者: S Shannon Nelson 提交者: Jeff Kirsher

i40e: add range check to i40e_aq_rc_to_posix

Just to be sure, add a range check to avoid any possible
array index-out-of-bound issues.

CC: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Change-ID: I9323bee6732c2a47599816e1d6c6b3a1f8dcbf54
Signed-off-by: NShannon Nelson <shannon.nelson@intel.com>
Acked-by: NMichal Kosiarz <michal.kosiarz@intel.com>
Tested-by: NJim Young <jamesx.m.young@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 74d0d0ed
......@@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
-EFBIG, /* I40E_AQ_RC_EFBIG */
};
if (aq_rc >= ARRAY_SIZE(aq_to_posix))
return -ERANGE;
return aq_to_posix[aq_rc];
}
......
......@@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
-EFBIG, /* I40E_AQ_RC_EFBIG */
};
if (aq_rc >= ARRAY_SIZE(aq_to_posix))
return -ERANGE;
return aq_to_posix[aq_rc];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册