Thread (10 messages) 10 messages, 4 authors, 3d ago

Re: [PATCH net v3 3/3] net: fealnx: bound card_idx to prevent out-of-bounds access

flat view

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-10-21 17:27:01
Also in: lkml, stable

quoted
+	if (card_idx >= MAX_CARD_IDX) {
+		dev_err(&pdev->dev, "card_idx is too big %d, aborting",
card_idx);
+		return -ENODEV;
+	}
 	card_idx++;
card_idx can reach 100000 is it ok? 
It is one of those stupid LLM issues which never happens, but
$DEVELOPER wants to fix it anyway.

If you unbind and bind the device lots, you can eventually get
card_idx to overflow. Assuming card_idx is a 32 bit int, and it takes
10ms to unbind/bind, you could make it overflow in about 18 months.

100,000 iterations makes it around 16 hours, which is feasible, so i
hope the submitted has tested it. But probably not, it is just
pointless LLM churn wasting all our time.

     Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help