From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 006C74A1384 for ; Tue, 9 Jun 2026 21:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781040985; cv=none; b=sTS+Tfpb5IBjXY/YIONBKT/gJiEtYbIf72NQiCJLEPFSQAmsrJeFraJ1ix43m0DjEWxbPLuCYoOKN1vRPmDAjPro+VCMrEnUcUMQYGlNmwJF2RXH09W6au5JcRoW3WDmNiIqlEscP36L5Kd/KUG0lMoWO7qUb8oInol8kIdrJtA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781040985; c=relaxed/simple; bh=U3yUU3HGEk8cqtRWdTyBWYJU/DC7CPcUg9P+e7J6ubk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZSpKpsqUjOE9q5cdxSYhzdFcdRTsW3+7yMZK68sP4HZ/4JSsMody0NnZJRnvv/EK1Ja0iOdRp7nTuF5cKPDIbCsOQQ7cZRCeo4ndoMu5ln0/TbkTf286LwwD/AwlzRdmujEGi2nzFtFo5eiiG2FtaVWvca0oL5pvSMlNLU9pWHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UYbATTDz; arc=none smtp.client-ip=198.175.65.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UYbATTDz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781040979; x=1812576979; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U3yUU3HGEk8cqtRWdTyBWYJU/DC7CPcUg9P+e7J6ubk=; b=UYbATTDzL/3coWXtnV7yiaqnSFHhBRiwPnj9xwzetpH8tTj4P+b0oXlm gdpIxqsHpb+v0US5pZxrw2b0LAvRs2TioHTY9mLmMUsNUpRJN6WQcI7Eo u9HGBCPMvIVRMdmdt7nju+6AnSScDSl2taKYWruKJqIiJojJL+FecUl4u ddNcgxDceAWTcx1t7ttN+1FlZhd+NOk0y04iWh/Hd90IMp+elCeBTbyVr tD5t/+qnTkj3A/W98MoaLeb+A4IcqmOc7Hc2uDif9YGb6UotWeqp0H2dP tG1A4iKH8JdSFRhFRY+gcPFHLZrJqLDwOi/PCEDRYqhMBPsQKTT6yJzUZ g==; X-CSE-ConnectionGUID: 0tfGPPxnTbWU6opPPhnAmw== X-CSE-MsgGUID: OKNyLVJVQZaQnuRfronIEA== X-IronPort-AV: E=McAfee;i="6800,10657,11812"; a="81568599" X-IronPort-AV: E=Sophos;i="6.24,196,1774335600"; d="scan'208";a="81568599" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2026 14:36:09 -0700 X-CSE-ConnectionGUID: pgZA8PKbSpinZayBL/W4ng== X-CSE-MsgGUID: EtO93m96Txe4XJT5BO0d1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,196,1774335600"; d="scan'208";a="245838604" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa008.jf.intel.com with ESMTP; 09 Jun 2026 14:36:09 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, andrew+netdev@lunn.ch, netdev@vger.kernel.org Cc: Agalakov Daniil , anthony.l.nguyen@intel.com, jacob.e.keller@intel.com, Iskhakov Daniil Subject: [PATCH net-next 12/15] e1000: limit endianness conversion to boundary words Date: Tue, 9 Jun 2026 14:35:53 -0700 Message-ID: <20260609213559.178657-13-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20260609213559.178657-1-anthony.l.nguyen@intel.com> References: <20260609213559.178657-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Agalakov Daniil [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 Signed-off-by: Tony Nguyen --- drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index 4dcbeabb3ad2..c15ad95c63c1 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c @@ -499,6 +499,9 @@ static int e1000_set_eeprom(struct net_device *netdev, if (ret_val) goto out; + /* Device's eeprom is always little-endian, word addressable */ + le16_to_cpus(&eeprom_buff[0]); + ptr++; } if ((eeprom->offset + eeprom->len) & 1) { @@ -509,11 +512,10 @@ static int e1000_set_eeprom(struct net_device *netdev, &eeprom_buff[last_word - first_word]); if (ret_val) goto out; - } - /* 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.47.1