Home
last modified time | relevance | path

Searched refs:kmalloc (Results 1 – 25 of 1627) sorted by relevance

12345678910>>...66

/linux/samples/kmemleak/
H A Dkmemleak-test.c43 pr_info("kmalloc(32) = 0x%px\n", kmalloc(32, GFP_KERNEL)); in kmemleak_test_init()
44 pr_info("kmalloc(32) = 0x%px\n", kmalloc(32, GFP_KERNEL)); in kmemleak_test_init()
45 pr_info("kmalloc(1024) = 0x%px\n", kmalloc(1024, GFP_KERNEL)); in kmemleak_test_init()
46 pr_info("kmalloc(1024) = 0x%px\n", kmalloc(1024, GFP_KERNEL)); in kmemleak_test_init()
47 pr_info("kmalloc(2048) = 0x%px\n", kmalloc(2048, GFP_KERNEL)); in kmemleak_test_init()
48 pr_info("kmalloc(2048) = 0x%px\n", kmalloc(2048, GFP_KERNEL)); in kmemleak_test_init()
49 pr_info("kmalloc(4096) = 0x%px\n", kmalloc(4096, GFP_KERNEL)); in kmemleak_test_init()
50 pr_info("kmalloc(4096) = 0x%px\n", kmalloc(4096, GFP_KERNEL)); in kmemleak_test_init()
77 per_cpu(kmemleak_test_pointer, i) = kmalloc(129, GFP_KERNEL); in kmemleak_test_init()
/linux/Documentation/translations/zh_CN/core-api/
H A Dmemory-allocation.rst19 Linux为内存分配提供了多种API。你可以使用 `kmalloc` 或 `kmem_cache_alloc`
109 分配内存的最直接的方法是使用kmalloc()系列的函数。而且,为了安全起见,最好使用将内存
114 可以用 `kmalloc` 分配的块的最大尺寸是有限的。实际的限制取决于硬件和内核配置,但是对于
115 小于页面大小的对象,使用 `kmalloc` 是一个好的做法。
117 用 `kmalloc` 分配的块的地址至少要对齐到ARCH_KMALLOC_MINALIGN字节。对于2的幂的大小,
120kmalloc()分配的块可以用krealloc()调整大小。与kmalloc_array()类似:以krealloc_array()
126 如果你不确定分配的大小对 `kmalloc` 来说是否太大,可以使用kvmalloc()及其派生函数。它将尝
127 试用kmalloc分配内存,如果分配失败,将用 `vmalloc` 重新尝试。对于哪些GFP标志可以与 `kvmalloc`
136 当分配的内存不再需要时,它必须被释放。你可以使用kvfree()来处理用 `kmalloc` 、 `vmalloc`
/linux/drivers/misc/lkdtm/
H A Dheap.c56 u32 *data = kmalloc(len, GFP_KERNEL); in lkdtm_SLAB_LINEAR_OVERFLOW()
77 base = kmalloc(len, GFP_KERNEL); in lkdtm_WRITE_AFTER_FREE()
86 again = kmalloc(len, GFP_KERNEL); in lkdtm_WRITE_AFTER_FREE()
104 base = kmalloc(len, GFP_KERNEL); in lkdtm_READ_AFTER_FREE()
110 val = kmalloc(len, GFP_KERNEL); in lkdtm_READ_AFTER_FREE()
161 base = kmalloc(len, GFP_KERNEL); in lkdtm_KFENCE_READ_AFTER_FREE()
225 val = kmalloc(1024, GFP_KERNEL); in lkdtm_READ_BUDDY_AFTER_FREE()
256 first = kmalloc(512, GFP_KERNEL); in lkdtm_SLAB_INIT_ON_ALLOC()
265 val = kmalloc(512, GFP_KERNEL); in lkdtm_SLAB_INIT_ON_ALLOC()
/linux/mm/kasan/
H A Dkasan_test_c.c203 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_oob_right()
232 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_oob_left()
292 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_big_oob_right()
311 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_large_oob_right()
325 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_large_uaf()
337 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_large_invalid_free()
388 ptr1 = kmalloc(size1, GFP_KERNEL); in krealloc_more_oob_helper()
423 ptr1 = kmalloc(size1, GFP_KERNEL); in krealloc_less_oob_helper()
490 ptr1 = kmalloc(size1, GFP_KERNEL); in krealloc_uaf()
511 ptr1 = RELOC_HIDE(kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL), 0); in kmalloc_oob_16()
[all …]
/linux/scripts/coccinelle/api/alloc/
H A Dalloc_cast.cocci3 /// like kmalloc, kzalloc, kmem_cache_alloc, kmem_cache_zalloc etc.
6 //# kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
34 \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
57 \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
80 \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
97 \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
/linux/scripts/coccinelle/api/
H A Dkvmalloc.cocci3 /// Find if/else condition with kmalloc/vmalloc calls.
35 * E = \(kmalloc\|kzalloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
45 * E = \(kmalloc\|kzalloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
57 * T x = \(kmalloc\|kzalloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
95 - E = kmalloc(size, flags);
101 - E = kmalloc(size, \(GFP_KERNEL\|GFP_KERNEL|__GFP_NOWARN\));
106 - E = kmalloc(size, flags | __GFP_NOWARN);
111 - E = kmalloc(size, \(GFP_KERNEL\|GFP_KERNEL|__GFP_NOWARN\));
116 - T x = kmalloc(size, flags | __GFP_NOWARN);
121 - T x = kmalloc(size, \(GFP_KERNEL\|GFP_KERNEL|__GFP_NOWARN\));
H A Dkfree_mismatch.cocci25 E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|
38 E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
68 * E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|
82 E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|
169 msg = "WARNING kmalloc is used to allocate this memory at line %s" % (a[0].line)
177 msg = "WARNING kmalloc is used to allocate this memory at line %s" % (a[0].line)
218 msg = "WARNING kmalloc (line %s) && vmalloc (line %s) are used to allocate this memory" % (ka[0].li…
227 msg = "WARNING kmalloc (line %s) && vmalloc (line %s) are used to allocate this memory" % (ka[0].li…
H A Dmemdup.cocci23 to = \(kmalloc@p\|kzalloc@p\)(strlen(from) + 1,flag);
33 to = \(kmalloc@p\|kzalloc@p\)(x,flag);
41 - to = \(kmalloc@p\|kzalloc@p\)(size,flag);
52 * to = \(kmalloc@p\|kzalloc@p\)(size,flag);
H A Dkstrdup.cocci23 - to = kmalloc(strlen(from) + 1,flag);
38 - to = \(kmalloc\|kzalloc\)(x,flag);
54 * to = kmalloc@p1(strlen(from) + 1,flag);
69 * to = \(kmalloc@p1\|kzalloc@p1\)(x,flag);
/linux/tools/testing/selftests/ftrace/test.d/trigger/
H A Dtrigger-hist.tc44 echo 'hist:keys=call_site.sym' > events/kmem/kmalloc/trigger
46 grep '{ call_site: \[[0-9a-f][0-9a-f]*\] [_a-zA-Z][_a-zA-Z]* *}' events/kmem/kmalloc/hist > /dev/nu…
53 echo 'hist:keys=call_site.sym-offset' > events/kmem/kmalloc/trigger
55 …[0-9a-f][0-9a-f]*\] [_a-zA-Z][_a-zA-Z]*+0x[0-9a-f][0-9a-f]*' events/kmem/kmalloc/hist > /dev/null …
H A Dtrigger-hist-mod.tc45 echo 'hist:keys=bytes_req.log2' > events/kmem/kmalloc/trigger
47 grep 'bytes_req: ~ 2^[0-9]*' events/kmem/kmalloc/hist > /dev/null || \
/linux/drivers/usb/misc/
H A Dcytherm.c84 buffer = kmalloc(8, GFP_KERNEL); in brightness_store()
127 buffer = kmalloc(8, GFP_KERNEL); in temp_show()
162 buffer = kmalloc(8, GFP_KERNEL); in button_show()
191 buffer = kmalloc(8, GFP_KERNEL); in port0_show()
216 buffer = kmalloc(8, GFP_KERNEL); in port0_store()
246 buffer = kmalloc(8, GFP_KERNEL); in port1_show()
271 buffer = kmalloc(8, GFP_KERNEL); in port1_store()
/linux/tools/virtio/linux/
H A Dkernel.h57 static inline void *kmalloc(size_t s, gfp_t gfp) in kmalloc() function
65 return kmalloc(n * s, gfp); in kmalloc_array()
70 void *p = kmalloc(s, gfp); in kzalloc()
78 return kmalloc(s, gfp); in alloc_pages_exact()
/linux/scripts/coccinelle/null/
H A Dkmerr.cocci2 /// This semantic patch looks for kmalloc etc that are not followed by a
5 /// in determining what the error handling code for the call to kmalloc etc
38 *x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
54 x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
/linux/net/bluetooth/
H A Decdh_helper.c53 tmp = kmalloc(64, GFP_KERNEL); in compute_ecdh_secret()
109 tmp = kmalloc(32, GFP_KERNEL); in set_ecdh_privkey()
118 buf = kmalloc(buf_len, GFP_KERNEL); in set_ecdh_privkey()
153 tmp = kmalloc(64, GFP_KERNEL); in generate_ecdh_public_key()
/linux/fs/quota/
H A Dquota_tree.c117 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in get_free_dqblk()
169 char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in remove_free_dqentry()
216 char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in insert_free_dqentry()
264 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in find_free_dqentry()
338 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in do_insert_tree()
444 char *ddquot = kmalloc(info->dqi_entry_size, GFP_KERNEL); in qtree_write_dquot()
483 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in free_dqentry()
547 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in remove_tree()
625 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in find_block_dqentry()
663 char *buf = kmalloc(info->dqi_usable_bs, GFP_KERNEL); in find_tree_dqentry()
[all …]
/linux/fs/cachefiles/
H A Dkey.c58 name = kmalloc(len + 1, GFP_KERNEL); in cachefiles_cook_key()
87 name = kmalloc(nlen, GFP_KERNEL); in cachefiles_cook_key()
107 name = kmalloc(b64len + 1, GFP_KERNEL); in cachefiles_cook_key()
/linux/arch/mips/loongson64/
H A Dreset.c156 kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL); in mips_reboot_setup()
160 kdump_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL); in mips_reboot_setup()
164 kexec_envp = kmalloc(KEXEC_ENVP_SIZE, GFP_KERNEL); in mips_reboot_setup()
/linux/drivers/media/usb/dvb-usb/
H A Ddibusb-common.c66 b = kmalloc(3, GFP_KERNEL); in dibusb_power_ctrl()
89 b = kmalloc(3, GFP_KERNEL); in dibusb2_0_streaming_ctrl()
122 b = kmalloc(3, GFP_KERNEL); in dibusb2_0_power_ctrl()
149 sndbuf = kmalloc(MAX_XFER_SIZE, GFP_KERNEL); in dibusb_i2c_msg()
380 buf = kmalloc(5, GFP_KERNEL); in dibusb_rc_query()
/linux/tools/virtio/ringtest/
H A Dptr_ring.c27 static void *kmalloc(unsigned size, gfp_t gfp) in kmalloc() function
40 return kmalloc(size, flags | __GFP_ZERO); in kzalloc()
47 return kmalloc(n * size, flags); in kmalloc_array()
/linux/tools/include/linux/
H A Dslab.h11 #define kzalloc_node(size, flags, node) kmalloc(size, flags)
33 void *kmalloc(size_t size, gfp_t gfp);
140 return kmalloc(size, gfp | __GFP_ZERO); in kzalloc()
/linux/fs/smb/server/
H A Dmisc.c170 pathname = kmalloc(PATH_MAX, KSMBD_DEFAULT_GFP); in convert_to_nt_pathname()
187 nt_pathname = kmalloc(prefix + ab_pathname_len + 1, KSMBD_DEFAULT_GFP); in convert_to_nt_pathname()
303 new_name = kmalloc(path_len + name_len + 2, KSMBD_DEFAULT_GFP); in convert_to_unix_name()
329 conv = kmalloc(sz, KSMBD_DEFAULT_GFP); in ksmbd_convert_dir_info_name()
/linux/drivers/gpib/
H A DTODO4 …CHECK:ALLOC_SIZEOF_STRUCT: Prefer kmalloc(sizeof(*board->private_data)...) over kmalloc(sizeof(str…
/linux/Documentation/core-api/
H A Dmemory-allocation.rst8 allocate small chunks using `kmalloc` or `kmem_cache_alloc` families,
136 from the kmalloc() family. And, to be on the safe side it's best to use
142 The maximal size of a chunk that can be allocated with `kmalloc` is
144 configuration, but it is a good practice to use `kmalloc` for objects
147 The address of a chunk allocated with `kmalloc` is aligned to at least
153 Chunks allocated with kmalloc() can be resized with krealloc(). Similarly
162 `kmalloc`, it is possible to use kvmalloc() and its derivatives. It will
163 try to allocate memory with `kmalloc` and if the allocation fails it
178 Objects allocated by `kmalloc` can be freed by `kfree` or `kvfree`. Objects
/linux/drivers/mtd/tests/
H A Dmtd_nandecctest.c259 error_data = kmalloc(size, GFP_KERNEL); in nand_ecc_test_run()
260 error_ecc = kmalloc(3, GFP_KERNEL); in nand_ecc_test_run()
261 correct_data = kmalloc(size, GFP_KERNEL); in nand_ecc_test_run()
262 correct_ecc = kmalloc(3, GFP_KERNEL); in nand_ecc_test_run()

12345678910>>...66