[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130814195829.GA1613@electric-eye.fr.zoreil.com>
Date: Wed, 14 Aug 2013 21:58:29 +0200
From: Francois Romieu <romieu@...zoreil.com>
To: Peter Wu <lekensteyn@...il.com>
Cc: netdev@...r.kernel.org, nic_swsd@...ltek.com
Subject: Re: [PATCH] r8169: fix invalid register dump
Peter Wu <lekensteyn@...il.com> :
[...]
> Heh, I forgot about that case. Fixed it in the below patch. By the way,
> have you observed similar behavior on other hardware?
Notwithstanding really old PCI adapters - sometimes - none that I remember of.
[...]
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index b5eb419..d367763 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -1897,12 +1897,19 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
> void *p)
> {
> struct rtl8169_private *tp = netdev_priv(dev);
> + char *bytes = p;
> + int i;
>
> if (regs->len > R8169_REGS_SIZE)
> regs->len = R8169_REGS_SIZE;
>
> rtl_lock_work(tp);
> - memcpy_fromio(p, tp->mmio_addr, regs->len);
> + if (regs->len >= 4) {
> + for (i = 0; i < regs->len - 4; i += 4)
> + memcpy_fromio(bytes + i, tp->mmio_addr + i, 4);
> + }
> + if (i < regs->len)
Comparison with random stack stuff when regs->len < 4. :o/
--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists