Received: by 2002:a19:651b:0:0:0:0:0 with SMTP id z27csp3749902lfb; Mon, 9 May 2022 03:18:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxELpZV1RukuPEwH+dETKHAZI71i0ivAPcZuANSV/XWDjXWRHHpweA6vVSEJwIeQ7F99PPI X-Received: by 2002:a17:90b:3e8b:b0:1dc:e920:e072 with SMTP id rj11-20020a17090b3e8b00b001dce920e072mr13638720pjb.151.1652091506056; Mon, 09 May 2022 03:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652091506; cv=none; d=google.com; s=arc-20160816; b=ImE63jnKtRvc5yTK8dCm+RV9FZ7+Ax53TftFNiB+LV4a6n9tK3i+UTTqivF/IaE1SV MdremHC6pzJu+uKc7qbzbgXOiNaGr9IeyVzRigu58DcRG20i2SWJSsuiaSCM8/wpn16p n7Mvml6gPsI2udeXi395DdZxaW6w7LW4EfEGXS7pA4AP+hTZh4+bgaLIq/bSSQSbgoo3 pOkVT0sp3wWmTybfD/5LeNNKoeaX1VaNPDIlV9S9RlNlA//V/4GvYBrZfG0IOZ/JHjUt 66uMRsm15kTXkSwXFiP2PMTw0GIsjGxAzJiaJ8a9joDtXNVANg1GDe1GimFvxalQv6Mi fIHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9A+y9PDcYTV+3BDPkG669L0FMzhgV70cq1ARje3fkgs=; b=TiPKLxDmOxH0kP+IUaHNjz24mfvD+6iYkitKUXOjcOQdf+WnWSAKLpzmt6sl1R/Ncg npyg999jx2lMdMBwq/gnn2Uu1W7yJ8oGvGvOJ9rGVr8oNDfF2LbLMAb6eAGPd8oSQM2q yqfURUlYp5EsQ/S1jWsv0jQUMUqf/8RTOwWzXD+NBLjS3Iv/DRgDAFvsGxW61RuHQomN LehDy0wfltAaB4OSy0N2DpDCs5qFeljUHtZ4G563+dtBbpby77gAsdTCh/yGiRLhbyxj XE8wuHJ+F2Wzzau0P1RwAWgR9gEWlR9HXf55yVfKEnhCTIL+NUQaNAD46AiljNAbzq/o H/fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ksd9ARsI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h29-20020a63385d000000b003822d0bffa5si14311502pgn.27.2022.05.09.03.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 03:18:26 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ksd9ARsI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1411F132751; Mon, 9 May 2022 02:55:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232589AbiEIEKq (ORCPT + 99 others); Mon, 9 May 2022 00:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbiEIEHp (ORCPT ); Mon, 9 May 2022 00:07:45 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF5B429835 for ; Sun, 8 May 2022 21:03:52 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id k14so11006047pga.0 for ; Sun, 08 May 2022 21:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9A+y9PDcYTV+3BDPkG669L0FMzhgV70cq1ARje3fkgs=; b=ksd9ARsI3qJYy0rsMGtM+GlMmr6fF4WTlfAo6BkfpqSWODocWLfDIFGQiHWfXDNesa x0Zvb581p38O6K010tGvMk2/fiWue0HtffDLgW3baH/AuRHleUYeQ1kRII8vMhNkQh6i Q6w5E0+PaeEimsqXdEr/bHv2Arctt7hWlzCSkuKrR4DfBmlFRS7/x1PqaIQRXhjKzeNK qFn7jinXxKyOEqdz9SmsCfHtfQxWfgnlgV0Ueyyk/j/w+JHpdj9+04lRPNRDrHtjsxyJ DhCRVcvAM/zDk/oNBvlxYuyGov9n9eBKmxCHVTu4PL6I8L3uF9GTDGaMOtDOyIgtRocC gPCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9A+y9PDcYTV+3BDPkG669L0FMzhgV70cq1ARje3fkgs=; b=DHuKKAfu9v9NLtz32yPevcR1lijJe+AB85FVkrY8JTWEguDCUVSHoiocmUZeuW7wVy twt83LQd0nAMEE9EGYLvS80okTenlBuIBfc8drJ9HSj0nyruD7jUo3ViIDl1m9MAahuY MjltGtjUGKAthtK0UOh31CYKxR3OGgqsunflhDYTupVcXvp/kkGTm4TPP7RkRl5h1Amy Q6RzpvN3lk1C1eGGCmWjxcvQvi8W51EITyfznGQjyK4F8Nvn7/G2xh253QPusawt8mO3 ld9K441YrJN9aL9EcGk27H/09yjG35p2rdEnHS3wasSDM2Nh8evIFEGkw17Uox7XhQ2c 7Vtw== X-Gm-Message-State: AOAM533XoyJWMyZqEAjmKAefcv+egxqrP8UTlEkhJGUqq2OjYUx2yYIZ LxsOv8VnEikDzwcbq4CFyK8= X-Received: by 2002:aa7:8888:0:b0:50f:2e7a:76b7 with SMTP id z8-20020aa78888000000b0050f2e7a76b7mr14301355pfe.48.1652069032230; Sun, 08 May 2022 21:03:52 -0700 (PDT) Received: from localhost ([152.70.90.187]) by smtp.gmail.com with ESMTPSA id w12-20020a17090aea0c00b001d9e3b0e10fsm11289877pjy.16.2022.05.08.21.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:03:51 -0700 (PDT) Date: Mon, 9 May 2022 12:03:48 +0800 From: Wang Cheng To: Pavel Skripkin Cc: dan.carpenter@oracle.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] staging: rtl8712: fix uninit-value in r871xu_drv_init() Message-ID: <20220509040348.57f3nbudn2izodqw@ppc.localdomain> References: <14c3886173dfa4597f0704547c414cfdbcd11d16.1651760402.git.wanngchenng@gmail.com> <46b89616-5ec7-fb04-f561-2647efd968c4@gmail.com> <20220506113320.gc6zryhm7uqnbva5@ppc.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 22/05/06 03:02PM, Pavel Skripkin wrote: > Hi Wang, > > On 5/6/22 14:33, Wang Cheng wrote: > > On 22/05/06 10:41AM, Pavel Skripkin wrote: > > > Hi Wang, > > > > > > On 5/6/22 06:16, Wang Cheng wrote: > > > > > > [snip] > > > > > > > > Reported-and-tested-by: > > > syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com > > > > Signed-off-by: Wang Cheng > > > > --- > > > > drivers/staging/rtl8712/usb_intf.c | 6 +++--- > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > diff --git a/drivers/staging/rtl8712/usb_intf.c > > > b/drivers/staging/rtl8712/usb_intf.c > > > > index ee4c61f85a07..50dcd3ecb685 100644 > > > > --- a/drivers/staging/rtl8712/usb_intf.c > > > > +++ b/drivers/staging/rtl8712/usb_intf.c > > > > @@ -538,13 +538,13 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf, > > > > } else { > > > > AutoloadFail = false; > > > > } > > > > - if (((mac[0] == 0xff) && (mac[1] == 0xff) && > > > > + if ((!AutoloadFail) || > > > > + ((mac[0] == 0xff) && (mac[1] == 0xff) && > > > > (mac[2] == 0xff) && (mac[3] == 0xff) && > > > > (mac[4] == 0xff) && (mac[5] == 0xff)) || > > > > ((mac[0] == 0x00) && (mac[1] == 0x00) && > > > > (mac[2] == 0x00) && (mac[3] == 0x00) && > > > > - (mac[4] == 0x00) && (mac[5] == 0x00)) || > > > > - (!AutoloadFail)) { > > > > + (mac[4] == 0x00) && (mac[5] == 0x00))) { > > > > > > > > > That looks ugly. I mean mac checks. Can we, please, use sane kernel API like > > > is_valid_ether_addr()? > > > > Good idea! But will is_valid_ether_addr() check a larger range? > > The comment of is_valid_ether_addr()(include/linux/etherdevice.h) says: > > Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not > > a *multicast address*, and is not FF:FF:FF:FF:FF:FF. > > > > I am not good an expert at networking stuff, but can multicast mac address > be valid for purpose of Wi-Fi adapter? IIUC it's can't, but as I said > before, I am not an expert Me neither. :P I found some reference here: https://en.wikipedia.org/wiki/Multicast_address#Ethernet And in the implementation of is_multicast_ether_addr()(include/linux/etherdevice.h), it checks one bit of mac address to determine a multicast or not. Probably some other kernel API could help. thanks, - w