linux-stable/sound/pci/asihpi
Tom Rix 9c3c9d37ae ALSA: asihpi: fix iounmap in error handler
[ Upstream commit 472eb39103 ]

clang static analysis flags this problem
hpioctl.c:513:7: warning: Branch condition evaluates to
  a garbage value
                if (pci.ap_mem_base[idx]) {
                    ^~~~~~~~~~~~~~~~~~~~

If there is a failure in the middle of the memory space loop,
only some of the memory spaces need to be cleaned up.

At the error handler, idx holds the number of successful
memory spaces mapped.  So rework the handler loop to use the
old idx.

There is a second problem, the memory space loop conditionally
iomaps()/sets the mem_base so it is necessay to initize pci.

Fixes: 719f82d398 ("ALSA: Add support of AudioScience ASI boards")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20200913165230.17166-1-trix@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-01 13:12:51 +02:00
..
asihpi.c ALSA: asihpi: Kill BUG_ON() usages 2017-09-07 10:52:37 +02:00
hpi.h ALSA: asihpi: New I/O types - AVB & BLUlink, DAB Rf receiver 2014-11-22 22:25:51 +01:00
hpi6000.c ALSA: asihpi: fix an information leak in asihpi_hpi_ioctl() 2014-12-31 14:12:43 +01:00
hpi6000.h
hpi6205.c ALSA: asihpi: Add support for stream interrupt. 2014-11-22 22:33:13 +01:00
hpi6205.h
hpi_internal.h ALSA: asihpi: increase tuner pad cache size 2014-12-18 08:48:24 +01:00
hpi_version.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hpicmn.c ALSA: asihpi: Refactor control cache code. 2014-11-22 22:29:58 +01:00
hpicmn.h ALSA: asihpi: Add support for stream interrupt. 2014-11-22 22:33:13 +01:00
hpidebug.c ALSA: asihpi: Put missing KERN_CONT prefix 2017-08-31 11:01:31 +02:00
hpidebug.h
hpidspcd.c ALSA: asihpi: relax firmware version check 2014-12-18 08:40:06 +01:00
hpidspcd.h
hpifunc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hpimsginit.c ALSA: asihpi: Hardening for potential Spectre v1 2018-05-01 12:58:15 -07:00
hpimsginit.h
hpimsgx.c ALSA: asihpi: Turn off msg/resp logging after DSP has crashed. 2014-11-22 22:33:25 +01:00
hpimsgx.h
hpioctl.c ALSA: asihpi: fix iounmap in error handler 2020-10-01 13:12:51 +02:00
hpioctl.h
hpios.c
hpios.h ALSA: asihpi: Add support for stream interrupt. 2014-11-22 22:33:13 +01:00
hpipcida.h
Makefile