Return-path: Received: from na3sys009aog111.obsmtp.com ([74.125.149.205]:37429 "EHLO na3sys009aog111.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750745Ab1GRIrH convert rfc822-to-8bit (ORCPT ); Mon, 18 Jul 2011 04:47:07 -0400 Received: by mail-ww0-f48.google.com with SMTP id 14so3102799wwi.29 for ; Mon, 18 Jul 2011 01:47:05 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1310647673-10144-1-git-send-email-geryk@ti.com> <1310647673-10144-2-git-send-email-geryk@ti.com> <874o2nx16b.fsf@purkki.adurom.net> <87aaccvaxr.fsf@purkki.adurom.net> <8762n0ukdu.fsf@purkki.adurom.net> Date: Mon, 18 Jul 2011 11:47:04 +0300 Message-ID: (sfid-20110718_104710_965996_97D71FCC) Subject: Re: [PATCH 2/2] wl12xx Export chip id to sysfs From: "Kahn, Gery" To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Luciano Coelho Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Mon, Jul 18, 2011 at 11:39, Kahn, Gery wrote: > On Mon, Jul 18, 2011 at 10:18, Kalle Valo wrote: >> Kalle Valo writes: >> >>>> After some investigation, found that ethtool's ioctl interface doesn't work >>>> at this case. >>> >>> This reminds me: I have patches for these issues but I never sent them >>> upstream. It's too late for me now, but I'll search them tomorrow (or >>> today to be exact..) and send them for testing purposes. >> >> Here's the patch I used: >> >> diff --git a/net/core/ethtool.c b/net/core/ethtool.c >> index 74ead9e..0836aa3 100644 >> --- a/net/core/ethtool.c >> +++ b/net/core/ethtool.c >> @@ -1185,7 +1185,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) >> ?{ >> ? ? ? ?struct ethtool_regs regs; >> ? ? ? ?const struct ethtool_ops *ops = dev->ethtool_ops; >> - ? ? ? void *regbuf; >> + ? ? ? void *regbuf = NULL; >> ? ? ? ?int reglen, ret; >> >> ? ? ? ?if (!ops->get_regs || !ops->get_regs_len) >> @@ -1198,18 +1198,24 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) >> ? ? ? ?if (regs.len > reglen) >> ? ? ? ? ? ? ? ?regs.len = reglen; >> >> - ? ? ? regbuf = vzalloc(reglen); >> - ? ? ? if (!regbuf) >> - ? ? ? ? ? ? ? return -ENOMEM; >> + ? ? ? if (reglen > 0) { >> + ? ? ? ? ? ? ? regbuf = vzalloc(reglen); >> + ? ? ? ? ? ? ? if (!regbuf) >> + ? ? ? ? ? ? ? ? ? ? ? return -ENOMEM; >> + ? ? ? } >> >> ? ? ? ?ops->get_regs(dev, ®s, regbuf); >> >> ? ? ? ?ret = -EFAULT; >> ? ? ? ?if (copy_to_user(useraddr, ®s, sizeof(regs))) >> ? ? ? ? ? ? ? ?goto out; >> - ? ? ? useraddr += offsetof(struct ethtool_regs, data); >> - ? ? ? if (copy_to_user(useraddr, regbuf, regs.len)) >> - ? ? ? ? ? ? ? goto out; >> + >> + ? ? ? if (regs.len > 0) { >> + ? ? ? ? ? ? ? useraddr += offsetof(struct ethtool_regs, data); >> + ? ? ? ? ? ? ? if (copy_to_user(useraddr, regbuf, regs.len)) >> + ? ? ? ? ? ? ? ? ? ? ? goto out; >> + ? ? ? } >> + >> ? ? ? ?ret = 0; >> >> ?out: >> > > Tested-by: Gery Kahn > I wanted to add thank you for sending your and reviewing my patch. It is good to have you around. Gery