Commit cee60c37 authored by Roel Kluin's avatar Roel Kluin Committed by Francois Romieu

r8169: fix past rtl_chip_info array size for unknown chipsets

'i' is unsigned.
Signed-off-by: default avatarRoel Kluin <12o3l@tiscali.nl>
Acked-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
parent 4b119e21
...@@ -1705,18 +1705,18 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1705,18 +1705,18 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
rtl8169_print_mac_version(tp); rtl8169_print_mac_version(tp);
for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) {
if (tp->mac_version == rtl_chip_info[i].mac_version) if (tp->mac_version == rtl_chip_info[i].mac_version)
break; break;
} }
if (i < 0) { if (i == ARRAY_SIZE(rtl_chip_info)) {
/* Unknown chip: assume array element #0, original RTL-8169 */ /* Unknown chip: assume array element #0, original RTL-8169 */
if (netif_msg_probe(tp)) { if (netif_msg_probe(tp)) {
dev_printk(KERN_DEBUG, &pdev->dev, dev_printk(KERN_DEBUG, &pdev->dev,
"unknown chip version, assuming %s\n", "unknown chip version, assuming %s\n",
rtl_chip_info[0].name); rtl_chip_info[0].name);
} }
i++; i = 0;
} }
tp->chipset = i; tp->chipset = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment