diff options
author | David Rientjes <rientjes@google.com> | 2009-08-26 14:29:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-26 20:06:52 -0700 |
commit | a30b595d2ca6d39e784a1bed5f2b35f3d7a03af7 (patch) | |
tree | 101d1cdf6088a36a09ad5470a062331a74ab657d /lib/rbtree.c | |
parent | 054b2b13ccba4876a1ce98a7ede7dab7d6893d01 (diff) | |
download | linux-a30b595d2ca6d39e784a1bed5f2b35f3d7a03af7.tar.bz2 |
flex_array: fix get function for elements in base starting at non-zero
If all array elements fit into the base structure and data is copied using
flex_array_put() starting at a non-zero index, flex_array_get() will fail
to return the data.
This fixes the bug by only checking for NULL parts when all elements do
not fit in the base structure when flex_array_get() is used. Otherwise,
fa_element_to_part_nr() will always be 0 since there are no parts
structures needed and such element may never have been put. Thus, it will
remain NULL due to the kzalloc() of the base.
Additionally, flex_array_put() now only checks for a NULL part when all
elements do not fit in the base structure. This is otherwise unnecessary
since the base structure is guaranteed to exist (or we would have already
hit a NULL pointer).
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/rbtree.c')
0 files changed, 0 insertions, 0 deletions