提交 e6a5fdf5 编写于 作者: D David S. Miller

[NIU]: Fix write past end of array in niu_pci_probe_sprom().

Noticed by Coverity checker and reported by Adrian Bunk.
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 65c88466
......@@ -6213,7 +6213,7 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
val = nr64(ESPC_MOD_STR_LEN);
niudbg(PROBE, "SPROM: MOD_STR_LEN[%llu]\n",
(unsigned long long) val);
if (val > 8 * 4)
if (val >= 8 * 4)
return -EINVAL;
for (i = 0; i < val; i += 4) {
......@@ -6229,7 +6229,7 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
val = nr64(ESPC_BD_MOD_STR_LEN);
niudbg(PROBE, "SPROM: BD_MOD_STR_LEN[%llu]\n",
(unsigned long long) val);
if (val > 4 * 4)
if (val >= 4 * 4)
return -EINVAL;
for (i = 0; i < val; i += 4) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册