From patchwork Thu Aug 23 07:17:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 1364741 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 839D8DF2AB for ; Thu, 23 Aug 2012 07:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933155Ab2HWHRM (ORCPT ); Thu, 23 Aug 2012 03:17:12 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:44712 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757986Ab2HWHRK (ORCPT ); Thu, 23 Aug 2012 03:17:10 -0400 Received: by mail-qc0-f174.google.com with SMTP id o28so279543qcr.19 for ; Thu, 23 Aug 2012 00:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=g5R8vymhRfR8IdoBHUoosKEtVeEEAuFXRc6vEdW8eYQ=; b=f7QFzZ0yE/iz2t2dyk/NpCMmeaNSA2hOHktJTvEV0hgVNgzT0ul6UQrqXEP/m7oXoX WDGSwEDrHWU7WGIAl+8W/S7TS3b+VacBQsHEpIGyQYTWz6uq2792w4Q+rH637Rcz01C8 jaUnF+v5LcGfs5uLqLZVNbqVfaP7vJKu2EIUSxuLIRG1AWO9NJ89xijFTBXyXpU72uST 19+J/oJLxa+6D0/v7/SUPuie54lRsiTd8FU/s1PJcBpCBG/o+FhbvlanhJehMFD7zFPN yy8nWL5gOHdiZsjCUgxttycKCYStYrcuLdQsCVIdNIzMYJb8GSWA/Qiog0uBtMbHoGyK W6+g== MIME-Version: 1.0 Received: by 10.224.184.20 with SMTP id ci20mr1413232qab.26.1345706229948; Thu, 23 Aug 2012 00:17:09 -0700 (PDT) Received: by 10.229.146.194 with HTTP; Thu, 23 Aug 2012 00:17:09 -0700 (PDT) Date: Thu, 23 Aug 2012 15:17:09 +0800 Message-ID: Subject: [PATCH] airo: use is_zero_ether_addr() and is_broadcast_ether_addr() From: Wei Yongjun To: linville@tuxdriver.com Cc: yongjun_wei@trendmicro.com.cn, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Wei Yongjun Using is_zero_ether_addr() and is_broadcast_ether_addr() instead of directly use memcmp() 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 --- drivers/net/wireless/airo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index f9f15bb..17c599d 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -5976,13 +5976,11 @@ static int airo_set_wap(struct net_device *dev, Cmd cmd; Resp rsp; APListRid APList_rid; - static const u8 any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - static const u8 off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; if (awrq->sa_family != ARPHRD_ETHER) return -EINVAL; - else if (!memcmp(any, awrq->sa_data, ETH_ALEN) || - !memcmp(off, awrq->sa_data, ETH_ALEN)) { + else if (is_broadcast_ether_addr(awrq->sa_data) || + is_zero_ether_addr(awrq->sa_data)) { memset(&cmd, 0, sizeof(cmd)); cmd.cmd=CMD_LOSE_SYNC; if (down_interruptible(&local->sem))