Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40806
b: refs/heads/master
c: af2c6a4
h: refs/heads/master
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Nov 7, 2006
1 parent ae34cce commit 3641082
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 25f484a62e41be8020b9a31bf50a792baa58d2d4
refs/heads/master: af2c6a4aaa2253f1e29df8fb59a3d92174d30a33
19 changes: 12 additions & 7 deletions trunk/drivers/net/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -10212,7 +10212,7 @@ static int __devinit tg3_phy_probe(struct tg3 *tp)
static void __devinit tg3_read_partno(struct tg3 *tp)
{
unsigned char vpd_data[256];
int i;
unsigned int i;
u32 magic;

if (tg3_nvram_read_swab(tp, 0x0, &magic))
Expand Down Expand Up @@ -10258,9 +10258,9 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
}

/* Now parse and find the part number. */
for (i = 0; i < 256; ) {
for (i = 0; i < 254; ) {
unsigned char val = vpd_data[i];
int block_end;
unsigned int block_end;

if (val == 0x82 || val == 0x91) {
i = (i + 3 +
Expand All @@ -10276,21 +10276,26 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
(vpd_data[i + 1] +
(vpd_data[i + 2] << 8)));
i += 3;
while (i < block_end) {

if (block_end > 256)
goto out_not_found;

while (i < (block_end - 2)) {
if (vpd_data[i + 0] == 'P' &&
vpd_data[i + 1] == 'N') {
int partno_len = vpd_data[i + 2];

if (partno_len > 24)
i += 3;
if (partno_len > 24 || (partno_len + i) > 256)
goto out_not_found;

memcpy(tp->board_part_number,
&vpd_data[i + 3],
partno_len);
&vpd_data[i], partno_len);

/* Success. */
return;
}
i += 3 + vpd_data[i + 2];
}

/* Part number not found. */
Expand Down

0 comments on commit 3641082

Please sign in to comment.