From: Kenji Kaneshige Date: Fri, 6 Jan 2006 06:45:44 +0000 (-0800) Subject: [PATCH] e1000: Fix invalid memory reference X-Git-Tag: v2.6.16-rc1~669^2~4 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32a4ec97461f00aa63747fc8978011ea771bd543;p=linux-2.6 [PATCH] e1000: Fix invalid memory reference Fix an invalid memory reference in the e1000 driver which would cause kernel panic. Signed-off-by: Kenji Kaneshige Cc: Jeb Cramer Cc: John Ronciak Cc: Ganesh Venkatesan Cc: Jeff Garzik Acked-by: Jeff Kirsher Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 38695d5b46..ccbbe5ad8e 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c @@ -545,7 +545,7 @@ e1000_check_fiber_options(struct e1000_adapter *adapter) static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) { - int speed, dplx; + int speed, dplx, an; int bd = adapter->bd_number; { /* Speed */ @@ -641,8 +641,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter) .p = an_list }} }; - int an = AutoNeg[bd]; - e1000_validate_option(&an, &opt, adapter); + if (num_AutoNeg > bd) { + an = AutoNeg[bd]; + e1000_validate_option(&an, &opt, adapter); + } else { + an = opt.def; + } adapter->hw.autoneg_advertised = an; }