Skip to content

Commit

Permalink
[NIU]: Fix write past end of array in niu_pci_probe_sprom().
Browse files Browse the repository at this point in the history
Noticed by Coverity checker and reported by Adrian Bunk.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Oct 15, 2007
1 parent 65c8846 commit e6a5fdf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/niu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit e6a5fdf

Please sign in to comment.