summaryrefslogtreecommitdiffstats
path: root/drivers/parisc
Commit message (Collapse)AuthorAgeFilesLines
* parisc: iosapic.c: Fix sparse warningsHelge Deller2023-08-312-4/+4
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: ccio-dma: Fix sparse warningsHelge Deller2023-08-312-11/+11
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: sba-iommu: Fix sparse warnigsHelge Deller2023-08-312-16/+16
| | | | | | Fix sparse warnings, as pdir is __le64 *. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: sba_iommu: Fix build warning if procfs if disabledHelge Deller2023-08-311-8/+2
| | | | | | | | | | | Clean up the code, e.g. make proc_mckinley_root static, drop the now empty mckinley header file and remove some unneeded ifdefs around procfs functions. Signed-off-by: Helge Deller <deller@gmx.de> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202308300800.Jod4sHzM-lkp@intel.com/ Fixes: 77e0ddf097d6 ("parisc: ccio-dma: Create private runway procfs root entry")
* parisc: ccio-dma: Create private runway procfs root entryHelge Deller2023-08-282-5/+8
| | | | | | | | | | | Create an own procfs "runway" root entry for the CCIO driver. No need to share it with the sba_iommu driver, as only one of those busses can be active in one machine anyway. Signed-off-by: Helge Deller <deller@gmx.de> Reported-by: kernel test robot <lkp@intel.com> Fixes: 547259580dfa ("parisc: Move proc_mckinley_root and proc_runway_root to sba_iommu") Cc: <stable@vger.kernel.org> # v6.5
* parisc: led: Rewrite LED/LCD driver to utilizize Linux LED subsystemHelge Deller2023-08-282-566/+340
| | | | | | | | | | | | | | | | Rewrite the whole driver and drop the own code to calculate load average, disk and LAN load. Switch instead to use the in-kernel LED subsystem, which gives us quite some advantages, e.g. - existing triggers for heartbeat and disk/lan activity can be used - users can configre the LEDs at will to any existing trigger via /sys/class/leds - less overhead since we don't need to run own timers - fully integrated in Linux and as such cleaner code. Note that the driver now depends on CONFIG_LEDS_CLASS which has to be built-in and not as module. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: lasi: Initialize LASI driver via arch_initcall()Helge Deller2023-08-272-12/+8
| | | | | | | | | | Move initialization code for LASI out of the GSC driver. Since ASP and WAX have been moved in previous commits, the GSC driver is now just a driver which provides library functions for LASI, ASP and WAX and as such doesn't need an own initialization function any longer. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: asp: Initialize asp driver via arch_initcall()Helge Deller2023-08-272-4/+9
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: wax: Initialize wax driver via arch_initcall()Helge Deller2023-08-272-7/+9
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: iosapic: Convert I/O Sapic driver to use arch_initcall()Helge Deller2023-08-271-4/+4
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: sba_iommu: Convert SBA IOMMU driver to use arch_initcall()Helge Deller2023-08-271-2/+3
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: led: Move register_led_regions() to late_initcall()Helge Deller2023-08-271-1/+3
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: lba: Convert LBA PCI bus driver to use arch_initcall()Helge Deller2023-08-271-2/+3
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: gsc: Convert GSC bus driver to use arch_initcall()Helge Deller2023-08-271-1/+3
| | | | | | This conversion includes LASI, ASP and WAX drivers for now. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: ccio: Convert CCIO driver to use arch_initcall()Helge Deller2023-08-271-11/+3
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: eisa: Convert HP EISA bus driver to use arch_initcall()Helge Deller2023-08-271-2/+3
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: hppb: Convert HP PB bus driver to use arch_initcall()Helge Deller2023-08-271-3/+4
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: dino: Convert dino PCI bus driver to use arch_initcall()Helge Deller2023-08-271-3/+3
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: Makefile: Adjust order in which drivers should be loadedHelge Deller2023-08-271-7/+9
| | | | | | | | This is the order in which the drivers are initialized in setup.c. The order is important when the drivers are convertet to use the initcall_*() startup framework. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: led: Reduce CPU overhead for disk & lan LED computationHelge Deller2023-08-261-2/+2
| | | | | | | | | | | | | | Older PA-RISC machines have LEDs which show the disk- and LAN-activity. The computation is done in software and takes quite some time, e.g. on a J6500 this may take up to 60% time of one CPU if the machine is loaded via network traffic. Since most people don't care about the LEDs, start with LEDs disabled and just show a CPU heartbeat LED. The disk and LAN LEDs can be turned on manually via /proc/pdc/led. Signed-off-by: Helge Deller <deller@gmx.de> Cc: <stable@vger.kernel.org>
* parisc: Avoid ioremap() for same addresss in iosapic_register()Helge Deller2023-08-222-3/+4
| | | | | | | | | The LBA has already called ioremap() to get it's virtual address, which can be used for the IOSAPIC as well. Avoid calling ioremap() again and just reuse the correct iomem address for the IOSAPIC. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: lasi: Register LASI power-off feature as sys_off_handlerHelge Deller2023-08-201-17/+11
| | | | | | | Prefer the Linux kernel sys_off_handler functionality over a home-grown implementation. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: Move proc_mckinley_root and proc_runway_root to sba_iommuHelge Deller2023-08-101-0/+6
| | | | | | Clean up the procfs root entries for gsc, runway, and mckinley busses. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: Move init function declarations into header fileHelge Deller2023-06-304-9/+1
| | | | | | | Clean up the code to not have external function declarations inside the C source files. Reduces warnings when compiled with W=1. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: dino: Make dino_init() returning voidHelge Deller2023-06-301-2/+1
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: lba_pci: Mark two variables __maybe_unusedHelge Deller2023-06-301-2/+2
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: ccio-dma: Fix kdoc and compiler warningsHelge Deller2023-06-301-6/+12
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: pdc_stable: Fix kdoc and compiler warningsHelge Deller2023-06-301-1/+35
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: sba_iommu: Fix kdoc warningsHelge Deller2023-06-301-12/+18
| | | | Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: Replace regular spinlock with spin_trylock on panic pathGuilherme G. Piccoli2023-05-031-6/+10
| | | | | | | | | | | | | | | | | | | The panic notifiers' callbacks execute in an atomic context, with interrupts/preemption disabled, and all CPUs not running the panic function are off, so it's very dangerous to wait on a regular spinlock, there's a risk of deadlock. Refactor the panic notifier of parisc/power driver to make use of spin_trylock - for that, we've added a second version of the soft-power function. Also, some comments were reorganized and trailing white spaces, useless header inclusion and blank lines were removed. Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: Jeroen Roovers <jer@xs4all.nl> Acked-by: Helge Deller <deller@gmx.de> # parisc Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com> Signed-off-by: Helge Deller <deller@gmx.de>
* Kconfig: introduce HAS_IOPORT option and select it as necessaryNiklas Schnelle2023-04-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce a new HAS_IOPORT Kconfig option to indicate support for I/O Port access. In a future patch HAS_IOPORT=n will disable compilation of the I/O accessor functions inb()/outb() and friends on architectures which can not meaningfully support legacy I/O spaces such as s390. The following architectures do not select HAS_IOPORT: * ARC * C-SKY * Hexagon * Nios II * OpenRISC * s390 * User-Mode Linux * Xtensa All other architectures select HAS_IOPORT at least conditionally. The "depends on" relations on HAS_IOPORT in drivers as well as ifdefs for HAS_IOPORT specific sections will be added in subsequent patches on a per subsystem basis. Co-developed-by: Arnd Bergmann <arnd@kernel.org> Signed-off-by: Arnd Bergmann <arnd@kernel.org> Acked-by: Johannes Berg <johannes@sipsolutions.net> # for ARCH=um Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* parisc: pdc_stable: use strscpy() to instead of strncpy()Xu Panda2023-01-091-6/+3
| | | | | | | | | The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: led: Fix potential null-ptr-deref in start_task()Shang XiaoJing2022-12-171-0/+3
| | | | | | | | | | | | | | | | | | | start_task() calls create_singlethread_workqueue() and not checked the ret value, which may return NULL. And a null-ptr-deref may happen: start_task() create_singlethread_workqueue() # failed, led_wq is NULL queue_delayed_work() queue_delayed_work_on() __queue_delayed_work() # warning here, but continue __queue_work() # access wq->flags, null-ptr-deref Check the ret value and return -ENOMEM if it is NULL. Fixes: 3499495205a6 ("[PARISC] Use work queue in LED/LCD driver instead of tasklet.") Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com> Signed-off-by: Helge Deller <deller@gmx.de> Cc: <stable@vger.kernel.org>
* parisc: Export iosapic_serial_irq() symbol for serial port driverHelge Deller2022-10-271-0/+1
| | | | | | | | | The parisc serial port driver needs this symbol when it's compiled as module. Signed-off-by: Helge Deller <deller@gmx.de> Reported-by: kernel test robot <lkp@intel.com> Cc: <stable@vger.kernel.org>
* parisc: Use signed char for hardware path in pdc.hHelge Deller2022-10-211-17/+17
| | | | | | | | | | | Clean up the struct for hardware_path and drop the struct device_path with a proper assignment of bc[] and mod members as signed chars. This patch prepares for the kbuild change from Jason A. Donenfeld to treat char as always unsigned. Signed-off-by: Helge Deller <deller@gmx.de> Cc: Jason A. Donenfeld <Jason@zx2c4.com>
* Merge tag 'parisc-for-6.1-1' of ↵Linus Torvalds2022-10-141-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux Pull parisc updates from Helge Deller: "Fixes: - When we added basic vDSO support in kernel 5.18 we introduced a bug which prevented a mmap() of graphic card memory. This is because we used the DMB (data memory break trap bit) page flag as special-bit, but missed to clear that bit when loading the TLB. - Graphics card memory size was not correctly aligned - Spelling fixes (from Colin Ian King) Enhancements: - PDC console (which uses firmware calls) now rewritten as early console - Reduced size of alternative tables" * tag 'parisc-for-6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix spelling mistake "mis-match" -> "mismatch" in eisa driver parisc: Fix userspace graphics card breakage due to pgtable special bit parisc: fbdev/stifb: Align graphics memory size to 4MB parisc: Convert PDC console to an early console parisc: Reduce kernel size by packing alternative tables
| * parisc: Fix spelling mistake "mis-match" -> "mismatch" in eisa driverColin Ian King2022-10-141-4/+4
| | | | | | | | | | | | | | There are several spelling mistakes in kernel error messages. Fix them. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
* | Merge tag 'asm-generic-6.1' of ↵Linus Torvalds2022-10-061-0/+6
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic Pull asm-generic updates from Arnd Bergmann: "This contains a series from Linus Walleij to unify the linux/io.h interface by making the ia64, alpha, parisc and sparc include asm-generic/io.h. All functions provided by the generic header are now available to all drivers, but the architectures can still override this. For the moment, mips and sh still don't include asm-generic/io.h but provide a full set of functions themselves. There are also a few minor cleanups unrelated to this" * tag 'asm-generic-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: alpha: add full ioread64/iowrite64 implementation parisc: Drop homebrewn io[read|write]64_[lo_hi|hi_lo] parisc: hide ioread64 declaration on 32-bit ia64: export memory_add_physaddr_to_nid to fix cxl build error asm-generic: Remove empty #ifdef SA_RESTORER parisc: Use the generic IO helpers parisc: Remove 64bit access on 32bit machines sparc: Fix the generic IO helpers alpha: Use generic <asm-generic/io.h>
| * parisc: Remove 64bit access on 32bit machinesLinus Walleij2022-09-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parisc was using some readq/writeq accessors without special considerations as to what will happen on 32bit CPUs if you do this. Maybe we have been lucky that it "just worked" on 32bit due to the compiler behaviour, or the code paths were never executed. Fix the two offending code sites like this: arch/parisc/lib/iomap.c: - Put ifdefs around the 64bit accessors and make sure that ioread64, ioread64be, iowrite64 and iowrite64be are not available on 32bit builds. - Also fold in a bug fix where 64bit access was by mistake using 32bit writel() accessors rather than 64bit writeq(). drivers/parisc/sba_iommu.c: - Access any 64bit registers using _lo_hi-semantics by way of the readq and writeq operations provided by <linux/io-64-nonatomic-lo-hi.h> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-parisc@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: John David Anglin <dave.anglin@bell.net> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* | parisc: remove obsolete manual allocation aligning in iosapicRolf Eike Beer2022-09-151-10/+1
| | | | | | | | | | | | | | | | kmalloc() returns memory with __assume_kmalloc_alignment, which is __alignof__(unsigned long long) for parisc. Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Signed-off-by: Helge Deller <deller@gmx.de>
* | parisc: ccio-dma: Add missing iounmap in error path in ccio_probe()Yang Yingliang2022-09-131-0/+1
|/ | | | | | | | | Add missing iounmap() before return from ccio_probe(), if ccio_init_resources() fails. Fixes: d46c742f827f ("parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources()") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: ccio-dma: Handle kmalloc failure in ccio_init_resources()Li Qiong2022-08-221-3/+8
| | | | | | | | As the possible failure of the kmalloc(), it should be better to fix this error path, check and return '-ENOMEM' error code. Signed-off-by: Li Qiong <liqiong@nfschina.com> Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: led: Move from strlcpy with unused retval to strscpyWolfram Sang2022-08-221-1/+1
| | | | | | | | | | Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: ccio-dma: Fix typo in commentJason Wang2022-08-221-1/+1
| | | | | | | The double `was' is duplicated in the comment, remove one. Signed-off-by: Jason Wang <wangborong@cdjrlc.com> Signed-off-by: Helge Deller <deller@gmx.de>
* Merge tag 'for-5.20/parisc-1' of ↵Linus Torvalds2022-08-051-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux Pull parisc updates from Helge Deller: "One real bugfix to change the io_pgetevents_time64() syscall to use the compat implementation when running in compat mode, otherwise the signed int32 parameters min_nr and nr will be incorrectly handled as unsigned int64 values. Other than that just small cleanups: - hardware database housekeeping and proper /proc/iomem output - add proper function exit code if probe functions fail - drop stale variables (pa_swapper_pg_lock) - drop unneccessary zero-initializations - typo fixes in comments" * tag 'for-5.20/parisc-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: Input: gscps2 - check return value of ioremap() in gscps2_probe() parisc: io_pgetevents_time64() needs compat syscall in 32-bit compat mode parisc: Drop zero variable initialisations in mm/init.c parisc: Do not initialise statics to 0 parisc: Check the return value of ioremap() in lba_driver_probe() parisc: Drop pa_swapper_pg_lock spinlock parisc: Fix comment typo in fault.c parisc: Fix device names in /proc/iomem parisc: Clean up names in hardware database
| * parisc: Check the return value of ioremap() in lba_driver_probe()William Dean2022-08-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | The function ioremap() in lba_driver_probe() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Reported-by: Hacash Robot <hacashRobot@santino.com> Signed-off-by: William Dean <williamsukatube@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de> Cc: <stable@vger.kernel.org> # v5.6+
* | genirq: Add and use an irq_data_update_affinity helperSamuel Holland2022-07-071-1/+1
|/ | | | | | | | | | | | | | | | Some architectures and irqchip drivers modify the cpumask returned by irq_data_get_affinity_mask, usually by copying in to it. This is problematic for uniprocessor configurations, where the affinity mask should be constant, as it is known at compile time. Add and use a setter for the affinity mask, following the pattern of irq_data_update_effective_affinity. This allows the getter function to return a const cpumask pointer. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # Xen bits Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220701200056.46555-7-samuel@sholland.org
* parisc: Fix CPU affinity for Lasi, WAX and Dino chipsHelge Deller2022-03-295-16/+71
| | | | | | | | | Add the missing logic to allow Lasi, WAX and Dino to set the CPU affinity. This fixes IRQ migration to other CPUs when a CPU is shutdown which currently holds the IRQs for one of those chips. Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: Fix sglist access in ccio-dma.cJohn David Anglin2022-01-281-1/+2
| | | | | | | | | This patch implements the same bug fix to ccio-dma.c as to sba_iommu.c. It ensures that only the allocated entries of the sglist are accessed. Signed-off-by: John David Anglin <dave.anglin@bell.net> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>
* parisc: Fix data TLB miss in sba_unmap_sgJohn David Anglin2022-01-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rolf Eike Beer reported the following bug: [1274934.746891] Bad Address (null pointer deref?): Code=15 (Data TLB miss fault) at addr 0000004140000018 [1274934.746891] CPU: 3 PID: 5549 Comm: cmake Not tainted 5.15.4-gentoo-parisc64 #4 [1274934.746891] Hardware name: 9000/785/C8000 [1274934.746891] [1274934.746891] YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI [1274934.746891] PSW: 00001000000001001111111000001110 Not tainted [1274934.746891] r00-03 000000ff0804fe0e 0000000040bc9bc0 00000000406760e4 0000004140000000 [1274934.746891] r04-07 0000000040b693c0 0000004140000000 000000004a2b08b0 0000000000000001 [1274934.746891] r08-11 0000000041f98810 0000000000000000 000000004a0a7000 0000000000000001 [1274934.746891] r12-15 0000000040bddbc0 0000000040c0cbc0 0000000040bddbc0 0000000040bddbc0 [1274934.746891] r16-19 0000000040bde3c0 0000000040bddbc0 0000000040bde3c0 0000000000000007 [1274934.746891] r20-23 0000000000000006 000000004a368950 0000000000000000 0000000000000001 [1274934.746891] r24-27 0000000000001fff 000000000800000e 000000004a1710f0 0000000040b693c0 [1274934.746891] r28-31 0000000000000001 0000000041f988b0 0000000041f98840 000000004a171118 [1274934.746891] sr00-03 00000000066e5800 0000000000000000 0000000000000000 00000000066e5800 [1274934.746891] sr04-07 0000000000000000 0000000000000000 0000000000000000 0000000000000000 [1274934.746891] [1274934.746891] IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000406760e8 00000000406760ec [1274934.746891] IIR: 48780030 ISR: 0000000000000000 IOR: 0000004140000018 [1274934.746891] CPU: 3 CR30: 00000040e3a9c000 CR31: ffffffffffffffff [1274934.746891] ORIG_R28: 0000000040acdd58 [1274934.746891] IAOQ[0]: sba_unmap_sg+0xb0/0x118 [1274934.746891] IAOQ[1]: sba_unmap_sg+0xb4/0x118 [1274934.746891] RP(r2): sba_unmap_sg+0xac/0x118 [1274934.746891] Backtrace: [1274934.746891] [<00000000402740cc>] dma_unmap_sg_attrs+0x6c/0x70 [1274934.746891] [<000000004074d6bc>] scsi_dma_unmap+0x54/0x60 [1274934.746891] [<00000000407a3488>] mptscsih_io_done+0x150/0xd70 [1274934.746891] [<0000000040798600>] mpt_interrupt+0x168/0xa68 [1274934.746891] [<0000000040255a48>] __handle_irq_event_percpu+0xc8/0x278 [1274934.746891] [<0000000040255c34>] handle_irq_event_percpu+0x3c/0xd8 [1274934.746891] [<000000004025ecb4>] handle_percpu_irq+0xb4/0xf0 [1274934.746891] [<00000000402548e0>] generic_handle_irq+0x50/0x70 [1274934.746891] [<000000004019a254>] call_on_stack+0x18/0x24 [1274934.746891] [1274934.746891] Kernel panic - not syncing: Bad Address (null pointer deref?) The bug is caused by overrunning the sglist and incorrectly testing sg_dma_len(sglist) before nents. Normally this doesn't cause a crash, but in this case sglist crossed a page boundary. This occurs in the following code: while (sg_dma_len(sglist) && nents--) { The fix is simply to test nents first and move the decrement of nents into the loop. Reported-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Signed-off-by: John David Anglin <dave.anglin@bell.net> Cc: stable@vger.kernel.org Signed-off-by: Helge Deller <deller@gmx.de>