Commit c2db1f8a authored by QiaoChong's avatar QiaoChong Committed by Kleber Sacilotto de Souza

parport_pc: fix find_superio io compare code, should use equal test.

BugLink: https://bugs.launchpad.net/bugs/1822271

commit 21698fd5 upstream.

In the original code before 181bf1e8 the loop was continuing until
it finds the first matching superios[i].io and p->base.
But after 181bf1e8 the logic changed and the loop now returns the
pointer to the first mismatched array element which is then used in
get_superio_dma() and get_superio_irq() and thus returning the wrong
value.
Fix the condition so that it now returns the correct pointer.

Fixes: 181bf1e8 ("parport_pc: clean up the modified while loops using for")
Cc: Alan Cox <alan@linux.intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarQiaoChong <qiaochong@loongson.cn>
[rewrite the commit message]
Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarJuerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent d9c65884
......@@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p)
{
int i;
for (i = 0; i < NR_SUPERIOS; i++)
if (superios[i].io != p->base)
if (superios[i].io == p->base)
return &superios[i];
return NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment