mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 16:41:58 +00:00
[NIU]: Fix write past end of array in niu_pci_probe_sprom().
Noticed by Coverity checker and reported by Adrian Bunk. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
65c8846660
commit
e6a5fdf56e
@ -6213,7 +6213,7 @@ static int __devinit niu_pci_probe_sprom(struct niu *np)
|
|||||||
val = nr64(ESPC_MOD_STR_LEN);
|
val = nr64(ESPC_MOD_STR_LEN);
|
||||||
niudbg(PROBE, "SPROM: MOD_STR_LEN[%llu]\n",
|
niudbg(PROBE, "SPROM: MOD_STR_LEN[%llu]\n",
|
||||||
(unsigned long long) val);
|
(unsigned long long) val);
|
||||||
if (val > 8 * 4)
|
if (val >= 8 * 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < val; i += 4) {
|
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);
|
val = nr64(ESPC_BD_MOD_STR_LEN);
|
||||||
niudbg(PROBE, "SPROM: BD_MOD_STR_LEN[%llu]\n",
|
niudbg(PROBE, "SPROM: BD_MOD_STR_LEN[%llu]\n",
|
||||||
(unsigned long long) val);
|
(unsigned long long) val);
|
||||||
if (val > 4 * 4)
|
if (val >= 4 * 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < val; i += 4) {
|
for (i = 0; i < val; i += 4) {
|
||||||
|
Loading…
Reference in New Issue
Block a user