linux_old1/arch/m68k/include/asm
Andreas Schwab ea077b1b96 m68k: Truncate base in do_div()
Explicitly truncate the second operand of do_div() to 32 bits to guard
against bogus code calling it with a 64-bit divisor.

[Thorsten]

After upgrading from 3.2 to 3.10, mounting a btrfs volume fails with:

btrfs: setting nodatacow, compression disabled
btrfs: enabling auto recovery
btrfs: disk space caching is enabled
*** ZERO DIVIDE ***   FORMAT=2
Current process id is 722
BAD KERNEL TRAP: 00000000
Modules linked in: evdev mac_hid ext4 crc16 jbd2 mbcache btrfs xor lzo_compress zlib_deflate raid6_pq crc32c libcrc32c
PC: [<319535b2>] __btrfs_map_block+0x11c/0x119a [btrfs]
SR: 2000  SP: 30c1fab4  a2: 30f0faf0
d0: 00000000    d1: 00001000    d2: 00000000    d3: 00000000
d4: 00010000    d5: 00000000    a0: 3085c72c    a1: 3085c72c
Process mount (pid: 722, task=30f0faf0)
Frame format=2 instr addr=319535ae
Stack from 30c1faec:
        00000000 00000020 00000000 00001000 00000000 01401000 30253928 300ffc00
        00a843ac 3026f640 00000000 00010000 0009e250 00d106c0 00011220 00000000
        00001000 301c6830 0009e32a 000000ff 00000009 3085c72c 00000000 00000000
        30c1fd14 00000000 00000020 00000000 30c1fd14 0009e26c 00000020 00000003
        00000000 0009dd8a 300b0b6c 30253928 00a843ac 00001000 00000000 00000000
        0000a008 3194e76a 30253928 00a843ac 00001000 00000000 00000000 00000002
Call Trace: [<00001000>] kernel_pg_dir+0x0/0x1000

    [...]

Code: 222e ff74 2a2e ff5c 2c2e ff60 4c45 1402 <2d40> ff64 2d41 ff68 2205 4c2e 1800 ff68 4c04 0800 2041 d1c0 2206 4c2e 1400 ff68

[Geert]

As diagnosed by Andreas, fs/btrfs/volumes.c:__btrfs_map_block()
calls

    do_div(stripe_nr, stripe_len);

with stripe_len u64, while do_div() assumes the divisor is a 32-bit number.

Due to the lack of truncation in the m68k-specific implementation of
do_div(), the division is performed using the upper 32-bit word of
stripe_len, which is zero.

This was introduced by commit 53b381b3ab
("Btrfs: RAID5 and RAID6"), which changed the divisor from
map->stripe_len (struct map_lookup.stripe_len is int) to a 64-bit temporary.

Reported-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Tested-by: Thorsten Glaser <tg@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@vger.kernel.org
2013-08-14 11:46:30 +02:00
..
Kbuild m68k: implement futex.h to support userspace robust futexes and PI mutexes 2013-05-21 21:29:13 +02:00
MC68EZ328.h m68k: fix comment typo 'occcured' 2011-04-10 17:01:05 +02:00
MC68VZ328.h m68k: fix comment typo 'occcured' 2011-04-10 17:01:05 +02:00
MC68328.h m68knommu: fix MC68328.h defines 2013-03-04 11:08:50 +10:00
a.out-core.h
adb_iop.h
amigahw.h m68k: Remove dead GG2 config option 2010-10-22 09:43:22 +02:00
amigaints.h
amigayle.h m68k: amiga - Amiga Gayle IDE platform device conversion 2010-05-26 19:51:09 +02:00
amipcmcia.h
apollohw.h m68k/apollo: Remove disabled definitions in apollohw.h 2012-08-18 15:15:56 +02:00
asm-offsets.h kbuild: move asm-offsets.h to include/generated 2009-12-12 13:08:14 +01:00
atafd.h
atafdreg.h
atari_joystick.h
atari_stdma.h
atari_stram.h m68k/atari: Reserve some ST-RAM early on for device buffer use 2011-07-30 21:21:39 +02:00
atarihw.h m68k/atari: EtherNAT - platform device and IRQ support code 2013-04-16 21:18:29 +02:00
atariints.h m68k/atari: EtherNAT - platform device and IRQ support code 2013-04-16 21:18:29 +02:00
atarikb.h input/atari: Use the correct mouse interrupt hook 2011-05-19 18:19:11 +02:00
atomic.h m68k: include asm/cmpxchg.h in our m68k atomic.h 2012-04-01 22:57:49 +02:00
barrier.h Disintegrate asm/system.h for M68K 2012-03-28 18:30:02 +01:00
bitops.h m68k: merge mmu and non-mmu bitops.h 2011-07-25 11:20:40 +10:00
blinken.h m68k/hp300: Export hp300_ledstate 2011-12-10 19:52:48 +01:00
bootinfo.h tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
bootstd.h Fix common misspellings 2011-03-31 11:26:23 -03:00
bug.h m68k: merge the mmu and non-mmu versions of bug.h 2009-03-24 15:17:44 +10:00
bugs.h m68k: merge the mmu and non-mmu versions of bugs.h 2009-03-24 15:17:45 +10:00
bvme6000hw.h
cache.h dma-mapping: rename ARCH_KMALLOC_MINALIGN to ARCH_DMA_MINALIGN 2010-08-11 08:59:21 -07:00
cacheflush.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
cacheflush_mm.h m68k: fix ColdFire clear cache operation 2012-07-17 15:49:34 +10:00
cacheflush_no.h m68knommu: use "r", not "i" constraint in cacheflush asm's 2012-09-27 23:28:40 +10:00
checksum.h m68k: simpler m68k and ColdFire CPU's can use generic csum code 2011-12-24 21:47:57 +10:00
cmpxchg.h m68k: Add missing cmpxchg64() if CONFIG_RMW_INSNS=y 2013-04-16 21:08:09 +02:00
coldfire.h m68knommu: remove ColdFire CLOCK_DIV config option 2011-03-15 21:01:57 +10:00
commproc.h m68k: remove rpxlite stuff 2013-04-05 13:28:27 +01:00
contregs.h
current.h m68k: merge the mmu and non-mmu versions of current.h 2009-03-24 15:17:45 +10:00
delay.h m68k: Implement ndelay() based on the existing udelay() logic 2013-04-16 21:35:40 +02:00
div64.h m68k: Truncate base in do_div() 2013-08-14 11:46:30 +02:00
dma-mapping.h m68k: Sort out !CONFIG_MMU_SUN3 vs. CONFIG_HAS_DMA 2013-02-09 14:23:36 +01:00
dma.h m68knommu: create and use a common M53xx ColdFire class of CPUs 2013-04-29 09:17:58 +10:00
dsp56k.h
dvma.h
elf.h default SET_PERSONALITY() in linux/elf.h 2013-02-26 02:46:08 -05:00
entry.h m68k: Correct the Atari ALLOWINT definition 2012-04-22 20:16:50 +02:00
fb.h m68k: merge the mmu and non-mmu versions of fb.h 2009-03-24 15:17:44 +10:00
fbio.h tree-wide: s/widht/width/g typo in comments 2010-02-05 12:22:42 +01:00
flat.h m68k: fix compiler warning by properly inlining flat_set_persistent() 2012-05-20 21:21:33 +10:00
floppy.h
fpu.h m68k: add ColdFire FPU support for the V4e ColdFire CPUs 2011-12-30 10:20:47 +10:00
ftrace.h tracing: make CALLER_ADDRx overwriteable 2009-03-02 16:49:37 -05:00
futex.h m68k: implement futex.h to support userspace robust futexes and PI mutexes 2013-05-21 21:29:13 +02:00
gpio.h m68k: only use local gpio_request_one if not using GPIOLIB 2013-05-29 16:56:45 +10:00
hardirq.h m68k/irq: Add genirq support 2011-11-08 22:35:49 +01:00
hp300hw.h
hwtest.h
ide.h m68knommu: arch/m68k/include/asm/ide.h fix for nommu 2010-08-18 12:44:31 +10:00
idprom.h
intersil.h
io.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
io_mm.h m68k/atari: ROM port ISA adapter support 2013-04-16 21:08:11 +02:00
io_no.h m68knommu: remove stubs for __ioremap() and iounmap() 2011-05-24 10:03:50 +10:00
irq.h m68k/atari: EtherNAT - platform device and IRQ support code 2013-04-16 21:18:29 +02:00
irqflags.h m68k, m68knommu: Do not include linux/hardirq.h in asm/irqflags.h 2010-11-03 11:30:07 +10:00
linkage.h
m52xxacr.h m68knommu: create optimal separate instruction and data cache for ColdFire 2011-01-05 15:19:20 +10:00
m53xxacr.h m68knommu: create and use a common M53xx ColdFire class of CPUs 2013-04-29 09:17:58 +10:00
m53xxsim.h m68knommu: fix ColdFire 5373/5329 QSPI base address 2013-04-29 09:17:59 +10:00
m54xxacr.h m68k: Set ColdFire ACR1 cache mode depending on kernel configuration 2013-04-29 09:17:57 +10:00
m54xxgpt.h m68knommu: clean up ColdFire 54xx General Timer definitions 2012-09-27 23:34:03 +10:00
m54xxpci.h m68k: add PCI bus support definitions for the ColdFire M54xx SoC family 2012-07-17 15:49:42 +10:00
m54xxsim.h m68knommu: clean up Pin Assignment definitions for the 54xx ColdFire CPU 2012-09-27 23:34:02 +10:00
m520xsim.h m68knommu: Add clk definitions for m520x. 2012-07-16 09:59:22 +10:00
m523xsim.h m68knommu: fix inconsistent formating in ColdFire 523x definitions 2012-09-27 23:34:04 +10:00
m525xsim.h m68knommu: merge ColdFire 5249 and 525x definitions 2012-12-05 10:51:21 +10:00
m527xsim.h m68knommu: fix inconsistent formating in ColdFire 527x definitions 2012-09-27 23:34:06 +10:00
m528xsim.h m68knommu: remove unused ColdFire 5282 register definitions 2012-09-27 23:33:55 +10:00
m5206sim.h m68knommu: make ColdFire Chip Select register definitions absolute addresses 2012-09-27 23:33:51 +10:00
m5272sim.h m68knommu: fix inconsistent formating in ColdFire 5272 definitions 2012-09-27 23:34:05 +10:00
m5307sim.h m68knommu: fix inconsistent formating in ColdFire 5307 definitions 2012-09-27 23:34:07 +10:00
m5407sim.h m68knommu: fix inconsistent formating in ColdFire 5407 definitions 2012-09-27 23:34:08 +10:00
m5441xsim.h m68knommu: Add rtc device for m5441x. 2012-07-16 09:59:21 +10:00
m68360.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
m68360_enet.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
m68360_pram.h
m68360_quicc.h Fix common misspellings 2011-03-31 11:26:23 -03:00
m68360_regs.h
mac_asc.h
mac_baboon.h m68k/mac: cleanup forward declarations 2011-12-10 19:52:46 +01:00
mac_iop.h m68k/mac: cleanup forward declarations 2011-12-10 19:52:46 +01:00
mac_oss.h m68k/mac: oss irq fixes 2011-12-10 19:52:47 +01:00
mac_psc.h m68k/mac: cleanup forward declarations 2011-12-10 19:52:46 +01:00
mac_via.h m68k/mac: fix nubus slot irq disable and shutdown 2011-12-10 19:52:47 +01:00
machdep.h m68k: set arch_gettimeoffset directly 2012-12-24 09:36:34 -07:00
machines.h
machw.h mac68k: replace mac68k SCC code with platform device 2010-02-27 18:31:09 +01:00
macintosh.h m68k/mac: cleanup macro case 2011-12-10 19:52:48 +01:00
macints.h m68k/mac: oss irq fixes 2011-12-10 19:52:47 +01:00
math-emu.h locking, m68k/asm-offsets: Rename pt_regs offset defines 2009-08-31 18:08:49 +02:00
mc146818rtc.h m68k: use the mc146818rtc.h for non-mmu setups as well. 2009-03-24 15:17:41 +10:00
mcf8390.h net: add support for NS8390 based eth controllers on some ColdFire CPU boards 2012-07-12 07:54:45 -07:00
mcf_pgalloc.h m68k: create ColdFire MMU pgalloc code 2011-12-30 10:20:40 +10:00
mcf_pgtable.h m68k: Add shared bit to Coldfire kernel page entries 2012-02-07 11:04:00 +10:00
mcfclk.h m68knommu: add clock creation support macro for other ColdFire CPUs 2012-12-05 10:51:24 +10:00
mcfdma.h m68knommu: move ColdFire DMA register addresses to per-cpu headers 2011-03-15 21:01:54 +10:00
mcfgpio.h m68knommu: create and use a common M53xx ColdFire class of CPUs 2013-04-29 09:17:58 +10:00
mcfintc.h m68knommu: map ColdFire interrupts to correct masking bits 2009-09-16 09:43:52 +10:00
mcfmmu.h m68k: ColdFire V4e MMU paging init code and miss handler 2011-12-30 10:20:38 +10:00
mcfpit.h m68knommu: move ColdFire PIT timer base addresses 2011-03-15 21:01:54 +10:00
mcfqspi.h m68knommu: make 532x QSPI platform addressing consistent 2012-03-05 09:43:09 +10:00
mcfsim.h m68knommu: create and use a common M53xx ColdFire class of CPUs 2013-04-29 09:17:58 +10:00
mcfslt.h m68knommu: move ColdFire slice timer address defiens to 54xx header 2012-09-27 23:34:01 +10:00
mcftimer.h m68knommu: create and use a common M53xx ColdFire class of CPUs 2013-04-29 09:17:58 +10:00
mcfuart.h m68knommu: Add support for the Coldfire 5251/5253 2012-07-16 09:59:21 +10:00
mcfwdebug.h
mmu.h m68k: merge the mmu and non-mmu versions of mmu.h 2009-03-24 15:17:42 +10:00
mmu_context.h m68k: ColdFire V4e MMU context support code 2011-12-30 10:20:34 +10:00
mmzone.h
module.h Make most arch asm/module.h files use asm-generic/module.h 2012-09-28 14:31:03 +09:30
motorola_pgalloc.h arch/m68k/include/asm/motorola_pgalloc.h: fix kunmap arg 2009-08-26 23:14:49 +02:00
motorola_pgtable.h m68k: use ColdFire MMU read/write bit flags when ioremapping 2011-12-30 10:20:37 +10:00
movs.h
mvme16xhw.h
mvme147hw.h
natfeat.h m68k/atari: Initial ARAnyM support 2011-03-16 19:10:41 +01:00
nettel.h m68knommu: fix wrong register offsets used for ColdFire 5272 multi-function pins 2012-09-27 23:33:54 +10:00
nubus.h
openprom.h
oplib.h
page.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
page_mm.h m68k: fix __page_to_pfn for a const struct page argument 2011-08-23 13:39:48 -07:00
page_no.h m68knommu: make non-MMU page_to_virt() return a void * 2012-12-05 10:51:22 +10:00
page_offset.h m68k: define PAGE_OFFSET_RAW for ColdFire CPU with MMU enabled 2011-12-30 10:20:31 +10:00
parport.h m68k/q40: Undefine insl/outsl before redefining them 2013-06-24 19:44:19 +02:00
pci.h m68k: common PCI support definitions and code 2012-07-17 15:49:41 +10:00
pgalloc.h m68k: create ColdFire MMU pgalloc code 2011-12-30 10:20:40 +10:00
pgtable.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
pgtable_mm.h consolidate io_remap_pfn_range definitions 2013-06-29 12:46:35 +04:00
pgtable_no.h consolidate io_remap_pfn_range definitions 2013-06-29 12:46:35 +04:00
processor.h m68knommu: fix trap on execing /bin/init 2013-02-06 11:13:23 +10:00
ptrace.h new helper: current_user_stack_pointer() 2012-12-19 18:07:39 -05:00
q40_master.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
q40ints.h m68k/irq: Remove obsolete m68k irq framework 2011-11-08 22:35:52 +01:00
quicc_simple.h
raw_io.h m68k/atari: ROM port ISA adapter support 2013-04-16 21:08:11 +02:00
rtc.h m68k: Hook up rtc-generic 2009-04-02 01:05:31 +00:00
segment.h m68k: use addr_limit checking for m68k CPUs that do no support address spaces 2011-12-30 10:20:22 +10:00
serial.h m68k/serial: SERIAL_PORT_DFNS only if CONFIG_ISA 2011-12-10 19:52:45 +01:00
setup.h UAPI: (Scripted) Disintegrate arch/m68k/include/asm 2012-10-09 09:47:06 +01:00
signal.h m68k: switch to generic old sigaction() 2013-02-03 18:16:00 -05:00
smp.h
string.h m68k: Remove inline strcpy() and strcat() implementations 2013-06-24 19:44:18 +02:00
sun3-head.h
sun3_pgalloc.h mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
sun3_pgtable.h m68k/sun3: Kill pte_unmap() warnings 2011-01-05 21:17:19 +01:00
sun3ints.h
sun3mmu.h
sun3x.h
sun3xflop.h Disintegrate asm/system.h for M68K 2012-03-28 18:30:02 +01:00
sun3xprom.h
switch_to.h Disintegrate asm/system.h for M68K 2012-03-28 18:30:02 +01:00
thread_info.h m68k: add TIF_NOTIFY_RESUME and handle it. 2012-05-21 23:59:47 -04:00
timex.h m68knommu: fix ColdFire definition of CLOCK_TICK_RATE 2009-09-16 09:43:56 +10:00
tlb.h
tlbflush.h m68k: add TLB flush support for the ColdFire V4e MMU hardware 2011-12-30 10:20:30 +10:00
traps.h m68k: print memory layout info in boot log 2011-12-24 21:47:57 +10:00
uaccess.h UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
uaccess_mm.h m68k/uaccess: Fix asm constraints for userspace access 2013-06-24 19:44:19 +02:00
uaccess_no.h
ucontext.h m68k: make fp register stores consistent for m68k and ColdFire 2011-12-24 21:47:57 +10:00
unaligned.h m68k: Introduce config option CPU_HAS_NO_UNALIGNED 2012-06-10 10:18:32 +02:00
unistd.h consolidate cond_syscall and SYSCALL_ALIAS declarations 2013-03-03 22:55:19 -05:00
user.h
vga.h m68k/video: Create <asm/vga.h> 2012-04-22 20:16:50 +02:00
virtconvert.h m68k: Eliminate unused variable in page_to_phys() 2010-02-27 18:31:18 +01:00
zorro.h