From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F21F3D3517B for ; Wed, 1 Apr 2026 12:09:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id BB58D41112; Wed, 1 Apr 2026 12:09:50 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id zZG44PyZ2yG6; Wed, 1 Apr 2026 12:09:50 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E2881410F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1775045389; bh=7kqU9KWB2xyKICoWVfvN1lhRdInz9hyw8uc0aMaA06o=; h=From:To:CC:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=3dtshRLHnUgZPqHmJIkXxH/9wFEzlPSEXOMBnhA7gI36y+CHHU9N8vBh0o2uMONSa Kdy6lkSVECG+bgJMm4buzLvOJkyjX79HIJcKYaiDJXGhobWpnRgN3cl4dkM3lBzw4h +xRvRZVxHfwgyGb7LOlpzxE4s4APsOHAT+HvCOWM4r6fVTouUALEV2uha9U1ojlqKR WR9T6nkEbN8Kpwzow7VQWXDdVM8EeIVXVswR/5UA259jzJpFjzsVx/L1QY4XfoB8p/ QIoPUWKXanKd0+HuCqidtAjQlRUP+PNP+5z4V5xWil3VYXPg8wnwFt1BduVSDSclNm YS1so836LCmjg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id E2881410F0; Wed, 1 Apr 2026 12:09:49 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 3F38725F for ; Wed, 1 Apr 2026 12:09:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DCECF808A8 for ; Wed, 1 Apr 2026 12:09:47 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id LHQ09pVUlynC for ; Wed, 1 Apr 2026 12:09:47 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=77.108.111.100; helo=mail.amicon.ru; envelope-from=ade@amicon.ru; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 6A42F80388 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6A42F80388 Received: from mail.amicon.ru (unknown [77.108.111.100]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6A42F80388 for ; Wed, 1 Apr 2026 12:09:46 +0000 (UTC) Content-Transfer-Encoding: 8bit Content-Type: text/plain Received: from example.com (172.16.2.46) by mail.amicon.lan (192.168.0.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.27; Wed, 1 Apr 2026 15:09:37 +0300 From: Agalakov Daniil To: Tony Nguyen CC: Agalakov Daniil , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , , , , , "Daniil Iskhakov" , Roman Razov Date: Wed, 1 Apr 2026 15:08:23 +0300 Message-ID: <20260401120919.282668-2-ade@amicon.ru> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260401120919.282668-1-ade@amicon.ru> References: <20260325151615.1407182-1-ade@amicon.ru> <20260401120919.282668-1-ade@amicon.ru> MIME-Version: 1.0 X-Originating-IP: [172.16.2.46] X-ClientProxiedBy: mail.amicon.lan (192.168.0.59) To mail.amicon.lan (192.168.0.59) X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; d=amicon.ru; s=mail; c=simple/simple; t=1775045378; h=from:subject:to:date:message-id; bh=HE4n1sAvPUoflg+jZgW88p4JQucSMSdvmERWpA9XOM0=; b=F4Ar2ddmu/V0RE31MzZB4vvAvI6SUAbdOdr/ny05IXiXQSOEgR752n0SRkKrE/E9eL/gy2jhi7f Ju8OiYOYr1eAcf1QkzP+q+Ig+fNwCRUpjtknQMA4lJ/zuiHjDEQg/TxhgIs4fwibVWA6BH9aYyiod X690AtZeDrLy+9eGIzs7hK9JFmLR3FogT0WAIdWn/oVIcImHhihnay4UtE00LQpXO3EgSWZq68/CK itGRZP41wpu6A/SC9OhUB4msBV7hhOLcBkT5PPfkU3152nqEEM/0hW9IwxclVy86U8iatntVDLa2v qOPLc0TC+o2xy2ktXcaPVrFfHwG+m1uJWSvg== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=amicon.ru X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=amicon.ru header.i=@amicon.ru header.a=rsa-sha256 header.s=mail header.b=F4Ar2ddm Subject: [Intel-wired-lan] [PATCH net-next v3 1/2] e1000: limit endianness conversion to boundary words X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" [Why] In e1000_set_eeprom(), the eeprom_buff is allocated to hold a range of words. However, only the boundary words (the first and the last) are populated from the EEPROM if the write request is not word-aligned. The words in the middle of the buffer remain uninitialized because they are intended to be completely overwritten by the new data via memcpy(). The previous implementation had a loop that performed le16_to_cpus() on the entire buffer. This resulted in endianness conversion being performed on uninitialized memory for all interior words. Fix this by converting the endianness only for the boundary words immediately after they are successfully read from the EEPROM. Found by Linux Verification Center (linuxtesting.org) with SVACE. Co-developed-by: Iskhakov Daniil Signed-off-by: Iskhakov Daniil Signed-off-by: Agalakov Daniil --- v2: - Split from the original bugfix series and targeted at 'net-next'. - Removed the Fixes: tag; limiting the conversion scope is an improvement to avoid unnecessary processing of uninitialized memory. - Improved commit description for clarity. drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index ab232b3fbbd0..38b1f91823ef 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c @@ -496,6 +496,10 @@ static int e1000_set_eeprom(struct net_device *netdev, */ ret_val = e1000_read_eeprom(hw, first_word, 1, &eeprom_buff[0]); + + /* Device's eeprom is always little-endian, word addressable */ + le16_to_cpus(&eeprom_buff[0]); + ptr++; } if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) { @@ -504,11 +508,10 @@ static int e1000_set_eeprom(struct net_device *netdev, */ ret_val = e1000_read_eeprom(hw, last_word, 1, &eeprom_buff[last_word - first_word]); - } - /* Device's eeprom is always little-endian, word addressable */ - for (i = 0; i < last_word - first_word + 1; i++) - le16_to_cpus(&eeprom_buff[i]); + /* Device's eeprom is always little-endian, word addressable */ + le16_to_cpus(&eeprom_buff[last_word - first_word]); + } memcpy(ptr, bytes, eeprom->len); -- 2.51.0