Skip to content

Commit

Permalink
[PATCH] m68k: completely initialize hw_regs_t in ide_setup_ports
Browse files Browse the repository at this point in the history
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 <zippel@linux-m68k.org>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Roman Zippel authored and Linus Torvalds committed Jun 23, 2006
1 parent daacf8b commit 2c3e026
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,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) {
Expand Down
1 change: 1 addition & 0 deletions drivers/ide/legacy/q40ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 2c3e026

Please sign in to comment.