All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
To: syzbot <syzbot+e0abb1d45ac291ebebeb@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, malathi.a2000@gmail.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [intel-wired-lan?] UBSAN: shift-out-of-bounds in e100_eeprom_load
Date: Mon, 17 Aug 2026 17:52:44 +0530	[thread overview]
Message-ID: <aoL9FOjjI2WNERzp@user> (raw)
In-Reply-To: <6a795b4a.01d0871a.3a0d52.00a0.GAE@google.com>

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 464dc2d6cdb5..5165f1d3c98f 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -746,10 +746,12 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
 		if (!(ctrl & eedo) && i > 16) {
 			u16 len = i - 16;
 
-			if (len > *addr_len)
+			if (len > *addr_len) {
 				*addr_len = 0;
-			else
-				*addr_len -= len;
+				break;
+			}
+
+			*addr_len -= len;
 			i = 17;
 		}
 
@@ -771,14 +773,14 @@ static int e100_eeprom_load(struct nic *nic)
 	/* Try reading with an 8-bit addr len to discover actual addr len */
 	e100_eeprom_read(nic, &addr_len, 0);
 
-	if (!addr_len || addr_len >= 16) {
+	if (!addr_len || addr_len > 8) {
 		netif_err(nic, probe, nic->netdev,
 			"Invalid EEPROM address length %u\n",
 			addr_len);
 		return -EIO;
 	}
 
-	nic->eeprom_wc = 1 << addr_len;
+	nic->eeprom_wc = (u16)BIT(addr_len);
 
 	for (addr = 0; addr < nic->eeprom_wc; addr++) {
 		nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
@@ -805,14 +807,14 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
 	/* Try reading with an 8-bit addr len to discover actual addr len */
 	e100_eeprom_read(nic, &addr_len, 0);
 
-	if (!addr_len || addr_len >= 16) {
+	if (!addr_len || addr_len > 8) {
 		netif_err(nic, probe, nic->netdev,
 			"Invalid EEPROM address length %u\n",
 			addr_len);
 		return -EIO;
 	}
 
-	nic->eeprom_wc = 1 << addr_len;
+	nic->eeprom_wc = (u16)BIT(addr_len);
 
 	if (start + count >= nic->eeprom_wc)
 		return -EINVAL;
-- 
2.43.0


  reply	other threads:[~2026-08-17 12:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260810043438.132082-1-malathi.a2000@gmail.com>
2026-08-10  5:02 ` [syzbot] [intel-wired-lan?] UBSAN: shift-out-of-bounds in e100_eeprom_load syzbot
2026-08-17 12:22   ` Yalagada Pavan Kumar [this message]
2026-08-17 12:35     ` syzbot
2026-08-17 13:00       ` Yalagada Pavan Kumar
2026-08-17 13:21         ` syzbot
     [not found] <20260807134621.45389-1-pavankumaryalagada@gmail.com>
2026-08-07 14:12 ` syzbot
2026-08-06 15:36 syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aoL9FOjjI2WNERzp@user \
    --to=pavankumaryalagada@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malathi.a2000@gmail.com \
    --cc=syzbot+e0abb1d45ac291ebebeb@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.