From 32a4ec97461f00aa63747fc8978011ea771bd543 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Thu, 5 Jan 2006 22:45:44 -0800 Subject: [PATCH] [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 --- drivers/net/e1000/e1000_param.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 38695d5b4637..ccbbe5ad8e0f 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; } -- 2.20.1