netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ibm_newemac: Fix dangerous struct assumption
@ 2009-04-06 12:27 Jean Delvare
  2009-04-07  0:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2009-04-06 12:27 UTC (permalink / raw)
  To: netdev, Josh Boyer; +Cc: Jeff Garzik

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.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
---
 drivers/net/ibm_newemac/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.30-rc0.orig/drivers/net/ibm_newemac/core.c	2009-04-06 11:18:25.000000000 +0200
+++ linux-2.6.30-rc0/drivers/net/ibm_newemac/core.c	2009-04-06 13:29:29.000000000 +0200
@@ -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;
 


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ibm_newemac: Fix dangerous struct assumption
  2009-04-06 12:27 [PATCH] ibm_newemac: Fix dangerous struct assumption Jean Delvare
@ 2009-04-07  0:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-04-07  0:43 UTC (permalink / raw)
  To: khali; +Cc: netdev, jwboyer, jgarzik

From: Jean Delvare <khali@linux-fr.org>
Date: Mon, 6 Apr 2009 14:27:10 +0200

> 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.
> 
> Signed-off-by: Jean Delvare <khali@linux-fr.org>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-07  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-06 12:27 [PATCH] ibm_newemac: Fix dangerous struct assumption Jean Delvare
2009-04-07  0:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).