linux/lib
Jesper Juhl 09c79b6096 mpi: Avoid using freed pointer in mpi_lshift_limbs()
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: Jesper Juhl <jj@chaosbits.net>
Acked-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
2012-04-18 12:14:28 +10:00
..
lzo
mpi mpi: Avoid using freed pointer in mpi_lshift_limbs() 2012-04-18 12:14:28 +10:00
raid6 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
reed_solomon
xz
zlib_deflate
zlib_inflate
.gitignore
argv_split.c
atomic64.c
atomic64_test.c
audit.c
average.c
bcd.c
bch.c
bitmap.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
bitrev.c
bsearch.c
btree.c
bug.c
bust_spinlocks.c
check_signature.c
checksum.c
clz_tab.c
cmdline.c
cordic.c
cpu-notifier-error-inject.c
cpu_rmap.c
cpumask.c lib/cpumask.c: remove __any_online_cpu() 2012-03-28 17:14:35 -07:00
crc-ccitt.c
crc-itu-t.c
crc-t10dif.c
crc7.c
crc8.c
crc16.c
crc32.c crc32: add self-test code for crc32c 2012-03-23 16:58:38 -07:00
crc32defs.h crc32: select an algorithm via Kconfig 2012-03-23 16:58:38 -07:00
ctype.c
debug_locks.c
debugobjects.c
dec_and_lock.c
decompress.c
decompress_bunzip2.c
decompress_inflate.c
decompress_unlzma.c
decompress_unlzo.c
decompress_unxz.c
devres.c
digsig.c
div64.c
dma-debug.c
dump_stack.c
dynamic_debug.c
dynamic_queue_limits.c
extable.c
fault-inject.c
find_last_bit.c
find_next_bit.c
flex_array.c
gcd.c
gen_crc32table.c crc32: bolt on crc32c 2012-03-23 16:58:38 -07:00
genalloc.c
halfmd4.c
hexdump.c
hweight.c
idr.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
inflate.c
int_sqrt.c
iomap.c
iomap_copy.c
iommu-helper.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
ioremap.c
irq_regs.c
is_single_threaded.c
kasprintf.c
Kconfig crc32: add help text for the algorithm select option 2012-03-28 17:14:37 -07:00
Kconfig.debug Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-03-29 14:28:26 -07:00
Kconfig.kgdb
Kconfig.kmemcheck
klist.c
kobject.c kobject: provide more diagnostic info for kobject_add_internal() failures 2012-04-10 14:48:51 -07:00
kobject_uevent.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
kstrtox.c
kstrtox.h
lcm.c
libcrc32c.c
list_debug.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
list_sort.c
llist.c Disintegrate and delete asm/system.h 2012-03-28 15:58:21 -07:00
locking-selftest-hardirq.h
locking-selftest-mutex.h
locking-selftest-rlock-hardirq.h
locking-selftest-rlock-softirq.h
locking-selftest-rlock.h
locking-selftest-rsem.h
locking-selftest-softirq.h
locking-selftest-spin-hardirq.h
locking-selftest-spin-softirq.h
locking-selftest-spin.h
locking-selftest-wlock-hardirq.h
locking-selftest-wlock-softirq.h
locking-selftest-wlock.h
locking-selftest-wsem.h
locking-selftest.c
lru_cache.c
Makefile
md5.c
nlattr.c
parser.c
pci_iomap.c
percpu_counter.c
plist.c
prio_heap.c
prio_tree.c prio_tree: introduce prio_set_parent() 2012-03-23 16:58:36 -07:00
proportions.c
radix-tree.c radix-tree: rewrite gang lookup using iterator 2012-03-28 17:14:37 -07:00
random32.c
ratelimit.c
rational.c
rbtree.c
reciprocal_div.c
rwsem-spinlock.c
rwsem.c
scatterlist.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
sha1.c
show_mem.c
smp_processor_id.c
sort.c
spinlock_debug.c
string.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
string_helpers.c
swiotlb.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
syscall.c
test-kstrtox.c
textsearch.c
timerqueue.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00
ts_bm.c
ts_fsm.c
ts_kmp.c
uuid.c
vsprintf.c The following text was taken from the original review request: 2012-03-24 10:24:31 -07:00