public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Steve Glendinning <steve@shawell.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: smsc95xx: detect chip revision specific features
Date: Tue, 27 Nov 2012 15:39:57 +0300	[thread overview]
Message-ID: <20121127123957.GT6186@mwanda> (raw)
In-Reply-To: <CAKh2mn4x=0HwUdH8hSbk3fsa16RUBqze_n5XegVjRBsTnT08SA@mail.gmail.com>

On Tue, Nov 27, 2012 at 12:32:26PM +0000, Steve Glendinning wrote:
> Hi Dan,
> 
> > drivers/net/usb/smsc95xx.c
> >   1283          if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
> >   1284                  u32 *filter_mask = kzalloc(32, GFP_KERNEL);
> >                                                    ^^
> > We allocate 8 unsigned 32 bit values.  I think this is the mistake here
> > actually.  It is a typo and should say:
> >
> >                         u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL);
> >
> > If 8 elements was the intent then that's nasty.
> 
> Good spot!  8 32-bit elements was the intent, but all the following
> code is actually accessing it using what should be byte offsets.  So I
> think this should read:
> 
>     u8 *filter_mask = kzalloc(32, GFP_KERNEL);
> 
> The rest of the code following makes sense then, up until:
> 
> >   1349                          ret = smsc95xx_write_reg_nopm(dev, WUFF, filter_mask[i]);
> 
> Which we'll need to change so it dereferences a u32 at that offset
> instead of a u8, something like *((u32 *)&filter_mask[i])
> 
> If this looks good to you I'll prepare a patch?
> 

Sound fine to me.  Could you give me the Reported-by: tag?

regards,
dan carpenter

  reply	other threads:[~2012-11-27 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 20:47 smsc95xx: detect chip revision specific features Dan Carpenter
2012-11-27 12:32 ` Steve Glendinning
2012-11-27 12:39   ` Dan Carpenter [this message]
2012-11-27 13:21     ` Steve Glendinning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121127123957.GT6186@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=steve@shawell.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox