lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 07 Apr 2009 17:45:50 -0600
From:	dougthompson@...ssion.com
To:	khali@...ux-fr.org, qingtao.cao@...driver.com, jharan@...cade.COM,
	dougthompson@...ssion.com, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org
Subject: [PATCH 1/3] edac: fix worktodo to proper cast

From: Jean Delvare <khali@...ux-fr.org>

The edac-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@...ux-fr.org>
Signed-off-by: Doug Thompson <dougthompson@...ssion.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(-)

Index: linux-2.6.29/drivers/edac/edac_device.c
===================================================================
--- linux-2.6.29.orig/drivers/edac/edac_device.c
+++ linux-2.6.29/drivers/edac/edac_device.c
@@ -389,7 +389,8 @@ 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 =
+			container_of(work_req, struct delayed_work, work);
 	struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
 
 	mutex_lock(&device_ctls_mutex);
Index: linux-2.6.29/drivers/edac/edac_mc.c
===================================================================
--- linux-2.6.29.orig/drivers/edac/edac_mc.c
+++ linux-2.6.29/drivers/edac/edac_mc.c
@@ -260,7 +260,8 @@ 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 =
+			container_of(work_req, struct delayed_work, work);
 	struct mem_ctl_info *mci = to_edac_mem_ctl_work(d_work);
 
 	mutex_lock(&mem_ctls_mutex);
Index: linux-2.6.29/drivers/edac/edac_pci.c
===================================================================
--- linux-2.6.29.orig/drivers/edac/edac_pci.c
+++ linux-2.6.29/drivers/edac/edac_pci.c
@@ -232,7 +232,8 @@ 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 =
+			container_of(work_req, struct delayed_work, work);
 	struct edac_pci_ctl_info *pci = to_edac_pci_ctl_work(d_work);
 	int msec;
 	unsigned long delay;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ