[PATCH 01/11] completely initialize hw_regs_t in ide_setup_ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ide_setup_ports does not completely initialize the hw_regs_t structure
which can cause random failures, as the structure is often on the stack.
None of the callers expect a partially initialized structure, i.e. none
of them do any setup of their own before calling ide_setup_ports().

Signed-off-by: Roman Zippel <[email protected]>

---

 drivers/ide/ide.c           |    1 +
 drivers/ide/legacy/q40ide.c |    1 +
 2 files changed, 2 insertions(+)

Index: linux-2.6-mm/drivers/ide/ide.c
===================================================================
--- linux-2.6-mm.orig/drivers/ide/ide.c
+++ linux-2.6-mm/drivers/ide/ide.c
@@ -730,6 +730,7 @@ void ide_setup_ports (	hw_regs_t *hw,
 {
 	int i;
 
+	memset(hw, 0, sizeof(hw_regs_t));
 	for (i = 0; i < IDE_NR_PORTS; i++) {
 		if (offsets[i] == -1) {
 			switch(i) {
Index: linux-2.6-mm/drivers/ide/legacy/q40ide.c
===================================================================
--- linux-2.6-mm.orig/drivers/ide/legacy/q40ide.c
+++ linux-2.6-mm/drivers/ide/legacy/q40ide.c
@@ -80,6 +80,7 @@ void q40_ide_setup_ports ( hw_regs_t *hw
 {
 	int i;
 
+	memset(hw, 0, sizeof(hw_regs_t));
 	for (i = 0; i < IDE_NR_PORTS; i++) {
 		/* BIG FAT WARNING: 
 		   assumption: only DATA port is ever used in 16 bit mode */

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux