[prev in list] [next in list] [prev in thread] [next in thread]
List: bluesmoke-devel
Subject: [PATCH] emac: Fix dangerous struct assumption
From: Jean Delvare <khali () linux-fr ! org>
Date: 2009-04-06 12:55:01
Message-ID: 20090406145501.5a2a7ed8 () hyperion ! delvare
[Download RAW message or body]
The emac-core 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: Doug Thompson <dougthompson@xmission.com>
---
drivers/edac/edac_device.c | 2 +-
drivers/edac/edac_mc.c | 2 +-
drivers/edac/edac_pci.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
--- linux-2.6.30-rc0.orig/drivers/edac/edac_device.c 2009-03-24 13:43:33.000000000 +0100
+++ linux-2.6.30-rc0/drivers/edac/edac_device.c 2009-04-06 14:40:48.000000000 +0200
@@ -389,7 +389,7 @@ static void del_edac_device_from_global_
*/
static void edac_device_workq_function(struct work_struct *work_req)
{
- struct delayed_work *d_work = (struct delayed_work *)work_req;
+ struct delayed_work *d_work = to_delayed_work(work_req);
struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
mutex_lock(&device_ctls_mutex);
--- linux-2.6.30-rc0.orig/drivers/edac/edac_mc.c 2009-03-24 13:43:33.000000000 +0100
+++ linux-2.6.30-rc0/drivers/edac/edac_mc.c 2009-04-06 14:40:14.000000000 +0200
@@ -260,7 +260,7 @@ static int edac_mc_assert_error_check_an
*/
static void edac_mc_workq_function(struct work_struct *work_req)
{
- struct delayed_work *d_work = (struct delayed_work *)work_req;
+ struct delayed_work *d_work = to_delayed_work(work_req);
struct mem_ctl_info *mci = to_edac_mem_ctl_work(d_work);
mutex_lock(&mem_ctls_mutex);
--- linux-2.6.30-rc0.orig/drivers/edac/edac_pci.c 2009-04-06 11:17:57.000000000 +0200
+++ linux-2.6.30-rc0/drivers/edac/edac_pci.c 2009-04-06 14:40:04.000000000 +0200
@@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(edac_pci_find);
*/
static void edac_pci_workq_function(struct work_struct *work_req)
{
- struct delayed_work *d_work = (struct delayed_work *)work_req;
+ struct delayed_work *d_work = to_delayed_work(work_req);
struct edac_pci_ctl_info *pci = to_edac_pci_ctl_work(d_work);
int msec;
unsigned long delay;
--
Jean Delvare
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
bluesmoke-devel mailing list
bluesmoke-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluesmoke-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic