Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2502047iob; Fri, 6 May 2022 04:28:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd4BtkiOcdfnsQSnMhxT6ny9Usqa5ZG45kFk0qndvzraTa/yNEhC5RU8zBF4Ho432GOjcK X-Received: by 2002:a17:907:8686:b0:6f4:b92c:8ef7 with SMTP id qa6-20020a170907868600b006f4b92c8ef7mr2483239ejc.651.1651836494527; Fri, 06 May 2022 04:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651836494; cv=none; d=google.com; s=arc-20160816; b=YvWFdcXXN4MdW21kgQYqIPaYTqmPJdzMIvVRDQ6xGC6ED9bS/EW5Ol/2ODxs2QPNRG fcvIZGMTxtXAe/a9JiQqrbJKY9ENC32TW4SSD+ozIHZseYgQFdQePdP8sBnUk7MU/HFt rCYIeEEgoqUikLae37ALih0Sarc1KMefake3U2H216mA7im6yqHRvencrdgxGq1zzMRz Wn9HAn9tzWgZSKT/oYwVBM54GT8fvMe7gQnmBpHkbViskhZhtNhBzE1wrjhQX+lN1kfD ZoTHxF0A9JBwlZ186rNT4ZN1zXqPF/Df4hHk5+wNOrhA17xgwX0cgHmXTt42YJaYJYJG jojw== 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=aBZn4BcWz4bBIlcve7wDRL7rKvV6xmhKQwDn/1BwkV4ateZTCXSVe5LNw4yt5H5Sa8 /83no39DSX8ysLQb9ZXuB/KswZxf8XX9Ct4htlX3pdr+lVJC7rdue2Tb+lLWGRyFCmX3 v5wvgdv5J/raMyHOef8b2JCYdAtimnTGb7NwlqsuP2kxIZHuIAOcl/pdcExEeTnR67hw bZyqWmgQWu4lcDxSvIcYM/kxXu3o7AZ5NwYg2xLvVRFDUbgK2i/nLWUmWUQ/8ZGiKZgJ nsA0l+txayiKmX/fY7vkl58TaINHZuYcRvK4vAPVgo0tg6L2vMNcMt7lnF6oSvMepa+j y0bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RHFW7PR2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a056402521100b0041d7658c96esi5010061edd.386.2022.05.06.04.27.38; Fri, 06 May 2022 04:28:14 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RHFW7PR2; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388460AbiEFDTw (ORCPT + 99 others); Thu, 5 May 2022 23:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388465AbiEFDTt (ORCPT ); Thu, 5 May 2022 23:19:49 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03F6C1705E for ; Thu, 5 May 2022 20:16:08 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id c14so5212229pfn.2 for ; Thu, 05 May 2022 20:16: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=RHFW7PR2ybJs1cy+WdEB+4lpWd2eFOMHKJZmV0VPnQ3dOQti4MvfAH0xOn7GBQwjvS YHzBwCTXh/ZMbjYw17lZW/f38S4m59xyaANd7N8pm/HSa+HuWReiLi19cEwVyr+nYMBt XgduYTfzuSR4yxsrqf19hnfQNgXLlBzb5ztyalWYNSHe54H6HfOHurJMY30C0k0UiJH4 d+yxSdfJmMzKN+H4IGCBLgq+80EegYaNK6EMHUa0Ix8A0VwDZZEmRN3ZqIu5bK3/ci6Q jYXXxillsD0hm0AOQ+uecBN9rBLVdjqXaVTPxH0FOGGJOxsPGivhEYmJxOZhjrPnFzBh Dmfw== 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=rsvmjC86sNRIKHo2Id3Nq1GdSajCqsSO0gUWGB4KggOUnw34fW6nHvOxRytwxU/N5F grY5IBKO5iuNckTZQar94mC+LddO+OWBskMAf2+qQTNyZpzDiSvupFj4bp0JVt3T4Vc9 uWeSbTT7Sv+VY6oxWOcDBOdJJMwsB5ieeNAw2YXlQev/zGojMiXXZLByQtWqrCQciUc4 +I2/Us1JCaKeU7itdyEm6NXYsKfUoFXuz4DR4uk+x9mRJfEU0IfzBh85MXk84b5Zgpcs TPCgfXaZBuPS6JD3SCTMI0UBxFy8WZk+w6Zf3xFFIQ18F7cvpoGbNFKcg/4unFv9RVAl 3Wbg== X-Gm-Message-State: AOAM530/sor9KB5xmBeXfduJNwZm7f7Ai9uXr14iW6f+Uu2UTXdcDMMC ROhZj0lXaAeczSCiRigKdYyQiXRoCWU= X-Received: by 2002:a05:6a00:a94:b0:4fd:c14b:21cb with SMTP id b20-20020a056a000a9400b004fdc14b21cbmr1245258pfl.53.1651806967551; Thu, 05 May 2022 20:16:07 -0700 (PDT) Received: from localhost ([152.70.90.187]) by smtp.gmail.com with ESMTPSA id q135-20020a632a8d000000b003c1c906048csm2084829pgq.88.2022.05.05.20.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 20:16:07 -0700 (PDT) Date: Fri, 6 May 2022 11:16:02 +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 v2 2/2] staging: rtl8712: fix uninit-value in r871xu_drv_init() Message-ID: <14c3886173dfa4597f0704547c414cfdbcd11d16.1651760402.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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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