From: Larry Finger <Larry.Finger@lwfinger.net>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org,
yongjun_wei@trendmicro.com.cn, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8712u: use is_zero_ether_addr() instead of memcmp()
Date: Thu, 23 Aug 2012 10:19:24 -0500 [thread overview]
Message-ID: <503649FC.1000104@lwfinger.net> (raw)
In-Reply-To: <CAPgLHd86=bmD30y6h0UT5ZM7mBgg6BNv2KNdvq5sHOqrO1dnsw@mail.gmail.com>
On 08/23/2012 01:40 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Using is_zero_ether_addr() instead of directly use
> memcmp(addr, "\x00\x00\x00\x00\x00\x00", ETH_ALEN)
> to determine if the ethernet address is all zeros.
>
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> drivers/staging/rtl8712/rtl871x_recv.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>
>
> diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
> index c9d1743..23ec684 100644
> --- a/drivers/staging/rtl8712/rtl871x_recv.c
> +++ b/drivers/staging/rtl8712/rtl871x_recv.c
> @@ -32,6 +32,7 @@
> #include <linux/slab.h>
> #include <linux/if_ether.h>
> #include <linux/kmemleak.h>
> +#include <linux/etherdevice.h>
>
> #include "osdep_service.h"
> #include "drv_types.h"
> @@ -331,8 +332,8 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
> return _FAIL;
> if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast))
> return _FAIL;
> - if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) ||
> - !memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) ||
> + if (is_zero_ether_addr(pattrib->bssid) ||
> + is_zero_ether_addr(mybssid) ||
> (memcmp(pattrib->bssid, mybssid, ETH_ALEN)))
> return _FAIL;
> sta_addr = pattrib->src;
> @@ -409,8 +410,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
> if ((memcmp(myhwaddr, pattrib->dst, ETH_ALEN)) && (!bmcast))
> return _FAIL;
> /* check BSSID */
> - if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) ||
> - !memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) ||
> + if (is_zero_ether_addr(pattrib->bssid) ||
> + is_zero_ether_addr(mybssid) ||
> (memcmp(pattrib->bssid, mybssid, ETH_ALEN)))
> return _FAIL;
> if (bmcast)
>
>
prev parent reply other threads:[~2012-08-23 15:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 6:40 Wei Yongjun
2012-08-23 15:19 ` Larry Finger [this message]
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=503649FC.1000104@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=weiyj.lk@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/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
Powered by JetHome