Skip to contentSkip to conversation

ibm_newemac: Fix dangerous struct assumption

PATCH Applied Jean Delvare 2 participants 2 messages Apr 6, 2009 – Apr 7, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibm_newemac: Fix dangerous struct assumption

The ibm_newemac driver includes code which assumes that the work_struct which is included in every delayed_work is the first member of that structure. This is currently the case but might change in the future, so use to_delayed_work() instead, which doesn't make such an assumption.

---
 drivers/net/ibm_newemac/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ibm_newemac/core.c +1 -1
@@ -1229,7 +1229,7 @@ static int emac_link_differs(struct emac
 static void emac_link_timer(struct work_struct *work)
 {
 	struct emac_instance *dev =
-		container_of((struct delayed_work *)work,
+		container_of(to_delayed_work(work),
 			     struct emac_instance, link_work);
 	int link_poll_interval;
 
Signature · 1 line
Jean Delvare
maintainer Applied
#1 lore raw

From: Jean Delvare <[email protected]>
Date: Mon, 6 Apr 2009 14:27:10 +0200

Quoted 7 lines

The ibm_newemac driver includes code which assumes that the work_struct which is included in every delayed_work is the first member of that structure. This is currently the case but might change in the future, so use to_delayed_work() instead, which doesn't make such an assumption.

Applied.