Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp12368803rwb; Sat, 26 Nov 2022 08:02:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Ait4N5rXyvA0L437Qr6t8eHnlxSBIJBiYeNLysd+bQ3QXU+p2FUcY15YTVriV6c5mYvS6 X-Received: by 2002:a17:902:e1cb:b0:189:6f3:63dd with SMTP id t11-20020a170902e1cb00b0018906f363ddmr23288053pla.168.1669478575347; Sat, 26 Nov 2022 08:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669478575; cv=none; d=google.com; s=arc-20160816; b=ZBcx/CqVmu2II471bCU8Hgk+dvteyf0R2e7bNY8lqRCt6c8NhrLY6J0qhlK1SaBRTE ZbJm53D4g8eTvr7VcR0hyC8/p5NqESgMvEZVj9q46ntzTl4pIYdAAWKFDAomVE5+MXik VES3zl/7N9r0XdRD9Kz/+7PAzTwz8q97JOpfpPbb8vvCMAeBuagyh8f1HYbmTSbb5MxB zgBGwJLWM2hmTAz7nHRf09WzZ4q19FQ01L4TzOQzy6/JluwEnhhevYQFfCktcIEBUqdW o8MVvVVH8ZfKingTwxX9BEkzHKkjq8XNcUl+GPM3eH4UT0BgALZAvpuqHxRMVWdc4cdK 9X1w== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j24-20020a63cf18000000b00476f101ef48si7340068pgg.7.2022.11.26.08.02.44; Sat, 26 Nov 2022 08:02: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 + 84 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 Content-Transfer-Encoding: 8bit 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 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); -- 2.30.2