From patchwork Sat Nov 26 15:42:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 26260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4700243wrr; Sat, 26 Nov 2022 07:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6lRIIG5H6fOL6Jr8vpZ2kUTjYNJUsHforQOVuOSJzhv/kIGxvTJaKaeOsXz5+FYprv3eIe X-Received: by 2002:a17:906:6417:b0:7ae:937f:2c38 with SMTP id d23-20020a170906641700b007ae937f2c38mr21259389ejm.201.1669477675041; Sat, 26 Nov 2022 07:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669477675; cv=none; d=google.com; s=arc-20160816; b=ZElMfsCg5QlxuqLlTklMLZDNOk+Kl2E6l3O3tIWukra9CIkGuVLFoyxXMx2ybOfY2D X/5oeGQJyoUDQxb4cg0cVNuH20UKHvY1BSvsO6QxGNiEIR7+O0ap6afjb24Txu3/yBuv Qd9DCLBaFD6HTiPTa4XFBmrFP6ceQEsJebhYt+L4u8imTkCcTYUReCYhu/VApFJb2vz/ VdqPOqnRjLdlDrl5zfG+Bit4Vb1K7bamNk+omTTIgIzIeml0EHz9HcSMnLMhXeV6Qk7t L8Rp8rc2SY6NTO17hrixMjbtMKir5ERL+WXQywVkJKh/B8gTs5WsZ3VtBylL2EkruadS UwVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NU5AjpdUgRD7xUGKVfgBMfdrcfNgq3hHf+JWjiLlf2s=; b=htP5sC30l1jYRM15vQicAAojL0S+ACjUQqcHwaEWsrHwAYZS7McBJTgwpEJdU9K156 ISYHawWbNX4BXb64hP+ANxtBXlevO7Un6VvJMF8MUMHKcie6eiBpqfRDYUpCA0E/inCD FJSw6MPrYODrYliNUJRt0Z9k1UAI5AcONqAHbeGxdDeElbSKC0g40yRESMJf8t1ICHYl miTuT3rVo4nCr6TglYcnCksdm0vQqFijSohor6zwQmGD4AKrlHSYWKpyTnZ1LwKyXt8y VHnNI4Z9SN7fHJ1ugbUSCsF27jGnvMI8sU2hfha8UkxOydXiPBivj1D0rwrfKNOVaZ6l Fs9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19-20020a170906c15300b007306ac0faa0si7481895ejc.615.2022.11.26.07.47.31; Sat, 26 Nov 2022 07:47:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbiKZPnQ (ORCPT + 99 others); Sat, 26 Nov 2022 10:43:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbiKZPnI (ORCPT ); Sat, 26 Nov 2022 10:43:08 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB52CE20 for ; Sat, 26 Nov 2022 07:43:07 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oyxKX-0000Lt-K2; Sat, 26 Nov 2022 16:43:01 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 4/5] staging: r8188eu: simplify the checks for zero address Date: Sat, 26 Nov 2022 16:42:52 +0100 Message-Id: <20221126154253.178275-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126154253.178275-1-martin@kaiser.cx> References: <20221126154253.178275-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750574222726324660?= X-GMAIL-MSGID: =?utf-8?q?1750574222726324660?= In function ap2sta_data_frame, we can use is_zero_ether_addr to check for all-zero ethernet addresses. Both pattrib->bssid and mybssid are 16-bit aligned. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_recv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 5b0a66aebff1..631c500dda42 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -779,9 +779,8 @@ static int ap2sta_data_frame( } /* check BSSID */ - if (!memcmp(pattrib->bssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || - !memcmp(mybssid, "\x0\x0\x0\x0\x0\x0", ETH_ALEN) || - (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) { + if (is_zero_ether_addr(pattrib->bssid) || is_zero_ether_addr(mybssid) || + (memcmp(pattrib->bssid, mybssid, ETH_ALEN))) { if (!bmcast) issue_deauth(adapter, pattrib->bssid, WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);