Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1737870imw; Sat, 9 Jul 2022 10:28:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vfubh2gnY7ZnnxL0RuK9k/oU4cp6vmOxo39DsPyXE+kwMKg7jNR/ovBNgVffPgEb+oF3Wg X-Received: by 2002:a17:902:aa4b:b0:164:11ad:af0f with SMTP id c11-20020a170902aa4b00b0016411adaf0fmr9683664plr.54.1657387739574; Sat, 09 Jul 2022 10:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657387739; cv=none; d=google.com; s=arc-20160816; b=Rc3Eb9225KdBzyx7+udgAjRaJ8wYouHuUV2DRlNVqutBKQHQhLCXBorsHBQK7V6+s3 6V4wf18syaRaljYZCf3HUjc3uveQiQfybsJCbhZz4TdBW/nZXuNgJwPdy38BzbHo74f6 fecLYb0iv6nV0D2eTt99EgMadLjw0ucs4wOFu4mf1FJuka7EQ4D8GMUBw3jXkscKehCw nVPcnqJq2CPkLpcBzSLlZwgtNIJFEM6jtdeI4xnbRgJFyX3RZDnG46qJwyIhXmzfixjw Wv91UmHOuSHXly7Q7Fkw241OsVUanMq9CW7wN1eSfDp59MElZq2zebo6OGoT45/eEC0Z ixsg== 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=JIcc96exG0sIc7O/EYOq50FQuZdFnjoaPvCf92nwoC4=; b=qrRV1cx0f3J49u3nwBnBF4RabGxfv1ojI1VAFfX35YKPsY75QE19Vo6DKY5NZhJQ13 9zgd4KXNkPLZlztpUuOh9/+/qvOq1dfJ+JBN2511oiYNwhezBUJvKySBR0TAqVuxCrDE NrXiZmdPc/xIvcf3TP+rssMdC6dmQB2HcNUQZ0zaVqnVW29ynF7tCMrEYnuUrMXonNXk E7viUAtEB9YzT/8ewo2+UDj3OTDi23Ca8Ss8hTI+3BUxWNXqjihpP/JCTKq3kEi0/lIi aODE4ULoevpIJ326MQ0x8HfyuxuM9oJ4ZSSrTMCwPzmm5L3hOP/DOH31NX/sVs5vLU4x j5uA== 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 n13-20020a170903110d00b0016a17d08a7csi3566860plh.221.2022.07.09.10.28.46; Sat, 09 Jul 2022 10:28:59 -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; 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 S229709AbiGIRKd (ORCPT + 99 others); Sat, 9 Jul 2022 13:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbiGIRKW (ORCPT ); Sat, 9 Jul 2022 13:10:22 -0400 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 9502211C06 for ; Sat, 9 Jul 2022 10:10:21 -0700 (PDT) Received: from dslb-188-096-144-007.188.096.pools.vodafone-ip.de ([188.96.144.7] 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 1oADyD-0005n0-Cb; Sat, 09 Jul 2022 19:10:17 +0200 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 06/14] staging: r8188eu: always initialise efuse buffer with 0xff Date: Sat, 9 Jul 2022 19:09:52 +0200 Message-Id: <20220709171000.180481-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220709171000.180481-1-martin@kaiser.cx> References: <20220709171000.180481-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,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 If BOOT_FROM_EEPROM is set, efuse_buf is not initialised before it is passed to functions that read from it. The buffer will be filled with 0x00 in this case like all local variables. However, the parsing functions expect the buffer to be filled with 0xFF if reading eeprom/efuse data failed. Fill the buffer with 0xFF before we try to read the data. Please note that this problem existed before we started using a local buffer. Adapter->eeprompriv->efuse_eeprom_data was allocated as a part of struct adapter by a vzalloc call in rtw_usb_if1_init. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/hal/usb_halinit.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 807d8ce8cbfc..258ab963cf8a 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -940,14 +940,12 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter) eeprom->bautoload_fail_flag = !(eeValue & EEPROM_EN); - if (!(eeValue & BOOT_FROM_EEPROM)) { - if (eeprom->bautoload_fail_flag) { - memset(efuse_buf, 0xFF, sizeof(efuse_buf)); - } else { - rtl8188e_EfusePowerSwitch(Adapter, true); - rtl8188e_ReadEFuse(Adapter, 0, EFUSE_MAP_LEN_88E, efuse_buf); - rtl8188e_EfusePowerSwitch(Adapter, false); - } + memset(efuse_buf, 0xFF, sizeof(efuse_buf)); + + if (!(eeValue & BOOT_FROM_EEPROM) && !eeprom->bautoload_fail_flag) { + rtl8188e_EfusePowerSwitch(Adapter, true); + rtl8188e_ReadEFuse(Adapter, 0, EFUSE_MAP_LEN_88E, efuse_buf); + rtl8188e_EfusePowerSwitch(Adapter, false); } /* parse the eeprom/efuse content */ -- 2.30.2