aboutsummaryrefslogtreecommitdiff
path: root/lib/btree.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 431Thomas Gleixner1-3/+1
Based on 1 normalized pattern(s): as should be obvious for linux kernel code license is gplv2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 1 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Armijn Hemel <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-14btree: avoid variable-length allocationsJoern Engel1-4/+6
geo->keylen cannot be larger than 4. So we might as well make fixed-size allocations. Given the one remaining user, geo->keylen cannot even be larger than 1. Logfs used to have 64bit and 128bit keys, tcm_qla2xxx only has 32bit keys. But let's not break the code if we don't have to. Signed-off-by: Joern Engel <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2015-11-23treewide: Remove old email addressPeter Zijlstra1-1/+1
There were still a number of references to my old Red Hat email address in the kernel source. Remove these while keeping the Red Hat copyright notices intact. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2014-06-04lib/btree.c: fix leak of whole btree nodesMinfei Huang1-0/+1
I use btree from 3.14-rc2 in my own module. When the btree module is removed, a warning arises: kmem_cache_destroy btree_node: Slab cache still has objects CPU: 13 PID: 9150 Comm: rmmod Tainted: GF O 3.14.0-rc2 #1 Hardware name: Inspur NF5270M3/NF5270M3, BIOS CHEETAH_2.1.3 09/10/2013 Call Trace: dump_stack+0x49/0x5d kmem_cache_destroy+0xcf/0xe0 btree_module_exit+0x10/0x12 [btree] SyS_delete_module+0x198/0x1f0 system_call_fastpath+0x16/0x1b The cause is that it doesn't release the last btree node, when height = 1 and fill = 1. [[email protected]: remove unneeded test of NULL] Signed-off-by: Minfei Huang <[email protected]> Cc: Joern Engel <[email protected]> Cc: Johannes Berg <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-06-07btree: catch NULL value before it does harmJoern Engel1-0/+1
Storing NULL values in the btree is illegal and can lead to memory corruption and possible other fun as well. Catch it on insert, instead of waiting for the inevitable. Signed-off-by: Joern Engel <[email protected]> Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-06-07btree: fix tree corruption in btree_get_prev()Roland Dreier1-2/+2
The memory the parameter __key points to is used as an iterator in btree_get_prev(), so if we save off a bkey() pointer in retry_key and then assign that to __key, we'll end up corrupting the btree internals when we do eg longcpy(__key, bkey(geo, node, i), geo->keylen); to return the key value. What we should do instead is use longcpy() to copy the key value that retry_key points to __key. This can cause a btree to get corrupted by seemingly read-only operations such as btree_for_each_safe. [[email protected]: avoid the double longcpy()] Signed-off-by: Roland Dreier <[email protected]> Acked-by: Joern Engel <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2012-01-10btree: export btree_get_prev() so modules can use btree_for_eachSteve Hodgson1-0/+1
The btree_for_each API is implemented with macros that internally call btree_get_prev(), so if btree_get_prev() isn't exported then modules fail to link if they try to use one of the btree_for_each macros. Since the rest of the btree API is exported, we should keep things orthogonal and make this work too. Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Steve Hodgson <[email protected]> Acked-by: Joern Engel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2011-03-31Fix common misspellingsLucas De Marchi1-2/+2
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <[email protected]>
2010-05-15lib/btree: fix possible NULL pointer dereference[email protected]1-1/+2
mempool_alloc() can return null in atomic case. Signed-off-by: Denis Kirjanov <[email protected]> Cc: Joern Engel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-11-20[LogFS] add new flash file systemJoern Engel1-0/+797
This is a new flash file system. See Documentation/filesystems/logfs.txt Signed-off-by: Joern Engel <[email protected]>