Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4698789iob; Sun, 8 May 2022 22:26:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqbpbbIpw4QJhd7lz5FiGwtdV5+nZdAZyK3WG3Hao4M7nusWE9elbymHxFcJOAwFcfw8z8 X-Received: by 2002:a05:6a00:16c5:b0:505:c572:7c2a with SMTP id l5-20020a056a0016c500b00505c5727c2amr14196391pfc.46.1652074013674; Sun, 08 May 2022 22:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652074013; cv=none; d=google.com; s=arc-20160816; b=xz1fsoPFekEfmIZUq0//X7yHzJQrX1fTk+XUGV89V8es8KKsA0/G3BMkMnljrQiagN y6ksmzv3v+1WRH2bqxFYu6bZti4hGAyQXz9gPywYYQ+XH64ZGkJ0WpQqhwwxSuOx61lB yIA0d2nVhm5AsWczenq25EvesLi2neoOSruJjtDJBXCnbGpBlV7yIBF7Kzm8yFf8YV1t ypGSh5M2LubeUfXad1nk7a3/kpme+fQIY2940AJDUhvmG52tE0kD0eCKLnN47VJJIXAR FpDiIqAxZ+6i6sAfFcsVDeE0Wuo5qNPHSV1fExKgvfXsc3yoa16LeU9RajMCLDhpvBV+ 52uQ== 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=nLavEAR5Aau9+5bXqJeGR1zfvkVlJijBBWww/pFaBdg=; b=PMcM+bNKkwgTRY+EyIHoGH1RFa0BqatQ/xN+hf1eJexWDTaO9mnQ9p1KmsMfP4CG26 G67SzLWEIvu4n+8ehbgfmYA2dIxGJ/EjkMKXyaUwl4aAs+ujSAmf3RvS7wbX5I8D/KOB DVi05ZNnVcAVWQx3J5sdum5yXZpmgHbs4ZyLWL8ebni1ZcZEnZZKKbDxiw8pnV8RKkcf OVIkl9kWpeiZlI8FCgQNpTLFSaCPxVKNczaZ6yRsQ6bWqprxufgRBvbJbLHnijQEJvG/ QxsED0myIZiPf7EnF/dIZECSg1TIbD/4byrf7dsODM7/DNdNGjXX+BWWTYTCweDSe1hF uYQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="DeEyjUY/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c13-20020a170903234d00b00156b46e2407si11854788plh.471.2022.05.08.22.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:26:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="DeEyjUY/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 B588A719DE; Sun, 8 May 2022 22:24:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391595AbiEFMDu (ORCPT + 99 others); Fri, 6 May 2022 08:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380114AbiEFMDt (ORCPT ); Fri, 6 May 2022 08:03:49 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F04A60DAA for ; Fri, 6 May 2022 05:00:07 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id 15so5936064pgf.4 for ; Fri, 06 May 2022 05:00:07 -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=nLavEAR5Aau9+5bXqJeGR1zfvkVlJijBBWww/pFaBdg=; b=DeEyjUY/AE4zdNZnPtis7a7XGLtDDO3d/lJzBjqrUsP9rcMTrXZBtw+hwaySnho1Fh jrngQRa8MGUKkyTvWSQPHeUWHpai58VlWs0CzkvL9r4rhBQFX+4LJDXxvIm+KxfjQhgj zBBE+TUgiT8YlED78tDChevr6U/iNmpKQq0DzNGtXVe5BnkuFcr+zX30CXxTVGXiq7xi otEGboTuUFFtpY5K3ed8WZ6ncFyMOvcvMfbfqlcVc2+zaGW3YBLDuObRJeBMyWccOxZm GQpR+FSAVBBQJ/AGHPOn+6SDjVlq3cSkkcrbnIAb3bJ5ADvUTxMbethyv1Sti66/oMIy z4dg== 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=nLavEAR5Aau9+5bXqJeGR1zfvkVlJijBBWww/pFaBdg=; b=FVwDzcgqRXa8jxoprjZwi/N0Njfnda9eAf86Zq56FTYD8sLwfoaTGPzFl9qdQYYXBH i6h9i9jV5L44f799TaDxFonOnlH1KdhDCqYbS1pq+tnJq67ADPgw8mLbDKKvtm2RQ+b/ MTqfP5OLz9RFB9eZ0AHA9ej3cykXskNdgMfJWU9r29De6IUlAI7H00ac68m8vv9/UYPN S6aZbJmId3wTLaY8IUf4cBn5452vAuL1lXIHO2Vfn3bWsrcE2YnR/GLTkMeqsZ7uwq6x dIen95qHQQqK9HvrXkfRJyEFnvks24tVleRRg9IzYHfFFsFGg/bdu8+ki0Sd4N0ve6OX RHkw== X-Gm-Message-State: AOAM532n9eSxXFdx68epz+AWm9K+b8ixCAjOHB5BGW3MugJO3jz2GFlX 0D/paRA2cyi0DUSL4MAm23Q= X-Received: by 2002:a63:8542:0:b0:3ab:4911:ec35 with SMTP id u63-20020a638542000000b003ab4911ec35mr2503523pgd.356.1651838406739; Fri, 06 May 2022 05:00:06 -0700 (PDT) Received: from localhost ([152.70.90.187]) by smtp.gmail.com with ESMTPSA id be12-20020a056a001f0c00b0050dc76281basm3233819pfb.148.2022.05.06.05.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 05:00:06 -0700 (PDT) Date: Fri, 6 May 2022 19:59:59 +0800 From: Wang Cheng To: dan.carpenter@oracle.com, paskripkin@gmail.com Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] staging: rtl8712: fix uninit-value in r871xu_drv_init() Message-ID: <14c3886173dfa4597f0704547c414cfdbcd11d16.1651833575.git.wanngchenng@gmail.com> References: 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 When 'tmpU1b' returns from r8712_read8(padapter, EE_9346CR) is 0, 'mac[6]' will not be initialized. BUG: KMSAN: uninit-value in r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541 r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396 really_probe+0x653/0x14b0 drivers/base/dd.c:596 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752 driver_probe_device drivers/base/dd.c:782 [inline] __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427 __device_attach+0x593/0x8e0 drivers/base/dd.c:970 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487 device_add+0x1fff/0x26e0 drivers/base/core.c:3405 usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238 usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293 really_probe+0x653/0x14b0 drivers/base/dd.c:596 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752 driver_probe_device drivers/base/dd.c:782 [inline] __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427 __device_attach+0x593/0x8e0 drivers/base/dd.c:970 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487 device_add+0x1fff/0x26e0 drivers/base/core.c:3405 usb_new_device+0x1b8e/0x2950 drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5358 [inline] hub_port_connect_change drivers/usb/core/hub.c:5502 [inline] port_event drivers/usb/core/hub.c:5660 [inline] hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5742 process_one_work+0xdb6/0x1820 kernel/workqueue.c:2307 worker_thread+0x10b3/0x21e0 kernel/workqueue.c:2454 kthread+0x3c7/0x500 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 Local variable mac created at: r871xu_drv_init+0x1771/0x3070 drivers/staging/rtl8712/usb_intf.c:394 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396 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))) { mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0x4c; -- 2.33.1