[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKh2mn4x=0HwUdH8hSbk3fsa16RUBqze_n5XegVjRBsTnT08SA@mail.gmail.com>
Date: Tue, 27 Nov 2012 12:32:26 +0000
From: Steve Glendinning <steve@...well.net>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: smsc95xx: detect chip revision specific features
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?
Steve
--
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