• Jesper Juhl's avatar
    mpi: Avoid using freed pointer in mpi_lshift_limbs() · 09c79b60
    Jesper Juhl authored
    At the start of the function we assign 'a->d' to 'ap'. Then we use the
    RESIZE_IF_NEEDED macro on 'a' - this may free 'a->d' and replace it
    with newly allocaetd storage. In that case, we'll be operating on
    freed memory further down in the function when we index into 'ap[]'.
    Since we don't actually need 'ap' until after the use of the
    RESIZE_IF_NEEDED macro we can just delay the assignment to it until
    after we've potentially resized, thus avoiding the issue.
    
    While I was there anyway I also changed the integer variable 'n' to be
    const. It might as well be since we only assign to it once and use it
    as a constant, and then the compiler will tell us if we ever assign to
    it in the future.
    Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
    Acked-by: default avatarDmitry Kasatkin <dmitry.kasatkin@intel.com>
    Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
    09c79b60
Name
Last commit
Last update
..
lzo Loading commit data...
mpi Loading commit data...
raid6 Loading commit data...
reed_solomon Loading commit data...
xz Loading commit data...
zlib_deflate Loading commit data...
zlib_inflate Loading commit data...
.gitignore Loading commit data...
Kconfig Loading commit data...
Kconfig.debug Loading commit data...
Kconfig.kgdb Loading commit data...
Kconfig.kmemcheck Loading commit data...
Makefile Loading commit data...
argv_split.c Loading commit data...
atomic64.c Loading commit data...
atomic64_test.c Loading commit data...
audit.c Loading commit data...
average.c Loading commit data...
bcd.c Loading commit data...
bch.c Loading commit data...
bitmap.c Loading commit data...
bitrev.c Loading commit data...
bsearch.c Loading commit data...
btree.c Loading commit data...
bug.c Loading commit data...
bust_spinlocks.c Loading commit data...
check_signature.c Loading commit data...
checksum.c Loading commit data...
clz_tab.c Loading commit data...
cmdline.c Loading commit data...
cordic.c Loading commit data...
cpu-notifier-error-inject.c Loading commit data...
cpu_rmap.c Loading commit data...
cpumask.c Loading commit data...
crc-ccitt.c Loading commit data...
crc-itu-t.c Loading commit data...
crc-t10dif.c Loading commit data...
crc16.c Loading commit data...
crc32.c Loading commit data...
crc32defs.h Loading commit data...
crc7.c Loading commit data...
crc8.c Loading commit data...
ctype.c Loading commit data...
debug_locks.c Loading commit data...
debugobjects.c Loading commit data...
dec_and_lock.c Loading commit data...
decompress.c Loading commit data...
decompress_bunzip2.c Loading commit data...
decompress_inflate.c Loading commit data...
decompress_unlzma.c Loading commit data...
decompress_unlzo.c Loading commit data...
decompress_unxz.c Loading commit data...
devres.c Loading commit data...
digsig.c Loading commit data...
div64.c Loading commit data...
dma-debug.c Loading commit data...
dump_stack.c Loading commit data...
dynamic_debug.c Loading commit data...
dynamic_queue_limits.c Loading commit data...
extable.c Loading commit data...
fault-inject.c Loading commit data...
find_last_bit.c Loading commit data...
find_next_bit.c Loading commit data...
flex_array.c Loading commit data...
gcd.c Loading commit data...
gen_crc32table.c Loading commit data...
genalloc.c Loading commit data...
halfmd4.c Loading commit data...
hexdump.c Loading commit data...
hweight.c Loading commit data...
idr.c Loading commit data...
inflate.c Loading commit data...
int_sqrt.c Loading commit data...
iomap.c Loading commit data...
iomap_copy.c Loading commit data...
iommu-helper.c Loading commit data...
ioremap.c Loading commit data...
irq_regs.c Loading commit data...
is_single_threaded.c Loading commit data...
kasprintf.c Loading commit data...
klist.c Loading commit data...
kobject.c Loading commit data...
kobject_uevent.c Loading commit data...
kstrtox.c Loading commit data...
kstrtox.h Loading commit data...
lcm.c Loading commit data...
libcrc32c.c Loading commit data...
list_debug.c Loading commit data...
list_sort.c Loading commit data...
llist.c Loading commit data...
locking-selftest-hardirq.h Loading commit data...
locking-selftest-mutex.h Loading commit data...
locking-selftest-rlock-hardirq.h Loading commit data...
locking-selftest-rlock-softirq.h Loading commit data...
locking-selftest-rlock.h Loading commit data...
locking-selftest-rsem.h Loading commit data...
locking-selftest-softirq.h Loading commit data...
locking-selftest-spin-hardirq.h Loading commit data...
locking-selftest-spin-softirq.h Loading commit data...
locking-selftest-spin.h Loading commit data...
locking-selftest-wlock-hardirq.h Loading commit data...
locking-selftest-wlock-softirq.h Loading commit data...
locking-selftest-wlock.h Loading commit data...
locking-selftest-wsem.h Loading commit data...
locking-selftest.c Loading commit data...
lru_cache.c Loading commit data...
md5.c Loading commit data...
nlattr.c Loading commit data...
parser.c Loading commit data...
pci_iomap.c Loading commit data...
percpu_counter.c Loading commit data...
plist.c Loading commit data...
prio_heap.c Loading commit data...
prio_tree.c Loading commit data...
proportions.c Loading commit data...
radix-tree.c Loading commit data...
random32.c Loading commit data...
ratelimit.c Loading commit data...
rational.c Loading commit data...
rbtree.c Loading commit data...
reciprocal_div.c Loading commit data...
rwsem-spinlock.c Loading commit data...
rwsem.c Loading commit data...
scatterlist.c Loading commit data...
sha1.c Loading commit data...
show_mem.c Loading commit data...
smp_processor_id.c Loading commit data...
sort.c Loading commit data...
spinlock_debug.c Loading commit data...
string.c Loading commit data...
string_helpers.c Loading commit data...
swiotlb.c Loading commit data...
syscall.c Loading commit data...
test-kstrtox.c Loading commit data...
textsearch.c Loading commit data...
timerqueue.c Loading commit data...
ts_bm.c Loading commit data...
ts_fsm.c Loading commit data...
ts_kmp.c Loading commit data...
uuid.c Loading commit data...
vsprintf.c Loading commit data...