From: Jean Delvare <khali@linux-fr.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Doug Thompson <dougthompson@xmission.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] emac: Fix dangerous struct assumption
Date: Wed, 8 Apr 2009 09:27:16 +0200 [thread overview]
Message-ID: <20090408092716.392c3005@hyperion.delvare> (raw)
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>
Signed-off-by: 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
reply other threads:[~2009-04-08 7:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090408092716.392c3005@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=akpm@linux-foundation.org \
--cc=dougthompson@xmission.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®