Home
last modified time | relevance | path

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

12345678910>>...89

/linux-6.1.9/samples/kmemleak/ !
Dkmemleak-test.c43 pr_info("kmalloc(32) = %p\n", kmalloc(32, GFP_KERNEL)); in kmemleak_test_init()
44 pr_info("kmalloc(32) = %p\n", kmalloc(32, GFP_KERNEL)); in kmemleak_test_init()
45 pr_info("kmalloc(1024) = %p\n", kmalloc(1024, GFP_KERNEL)); in kmemleak_test_init()
46 pr_info("kmalloc(1024) = %p\n", kmalloc(1024, GFP_KERNEL)); in kmemleak_test_init()
47 pr_info("kmalloc(2048) = %p\n", kmalloc(2048, GFP_KERNEL)); in kmemleak_test_init()
48 pr_info("kmalloc(2048) = %p\n", kmalloc(2048, GFP_KERNEL)); in kmemleak_test_init()
49 pr_info("kmalloc(4096) = %p\n", kmalloc(4096, GFP_KERNEL)); in kmemleak_test_init()
50 pr_info("kmalloc(4096) = %p\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-6.1.9/Documentation/translations/zh_CN/core-api/ !
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-6.1.9/drivers/staging/rtl8712/ !
Drtl871x_cmd.c55 pcmdpriv->cmd_allocated_buf = kmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, in r8712_init_cmd_priv()
62 pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC); in r8712_init_cmd_priv()
80 pevtpriv->evt_allocated_buf = kmalloc(MAX_EVTSZ + 4, GFP_ATOMIC); in r8712_init_evt_priv()
180 ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); in r8712_sitesurvey_cmd()
183 psurveyPara = kmalloc(sizeof(*psurveyPara), GFP_ATOMIC); in r8712_sitesurvey_cmd()
215 ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); in r8712_setdatarate_cmd()
218 pbsetdataratepara = kmalloc(sizeof(*pbsetdataratepara), GFP_ATOMIC); in r8712_setdatarate_cmd()
237 ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); in r8712_set_chplan_cmd()
240 psetchplanpara = kmalloc(sizeof(*psetchplanpara), GFP_ATOMIC); in r8712_set_chplan_cmd()
257 ph2c = kmalloc(sizeof(*ph2c), GFP_ATOMIC); in r8712_setrfreg_cmd()
[all …]
/linux-6.1.9/mm/kasan/ !
Dkasan_test.c131 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_oob_right()
160 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_oob_left()
194 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_pagealloc_oob_right()
210 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_pagealloc_uaf()
224 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_pagealloc_invalid_free()
275 ptr = kmalloc(size, GFP_KERNEL); in kmalloc_large_oob_right()
292 ptr1 = kmalloc(size1, GFP_KERNEL); in krealloc_more_oob_helper()
327 ptr1 = kmalloc(size1, GFP_KERNEL); in krealloc_less_oob_helper()
400 ptr1 = kmalloc(size1, GFP_KERNEL); in krealloc_uaf()
418 ptr1 = kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL); in kmalloc_oob_16()
[all …]
Dkasan_test_module.c25 kmem = kmalloc(size, GFP_KERNEL); in copy_user_test()
84 ptr = kmalloc(sizeof(struct kasan_rcu_info), GFP_KERNEL); in kasan_rcu_uaf()
109 work = kmalloc(sizeof(struct work_struct), GFP_KERNEL); in kasan_workqueue_uaf()
/linux-6.1.9/drivers/misc/lkdtm/ !
Dheap.c54 u32 *data = kmalloc(len, GFP_KERNEL); in lkdtm_SLAB_LINEAR_OVERFLOW()
75 base = kmalloc(len, GFP_KERNEL); in lkdtm_WRITE_AFTER_FREE()
84 again = kmalloc(len, GFP_KERNEL); in lkdtm_WRITE_AFTER_FREE()
102 base = kmalloc(len, GFP_KERNEL); in lkdtm_READ_AFTER_FREE()
108 val = kmalloc(len, GFP_KERNEL); in lkdtm_READ_AFTER_FREE()
165 val = kmalloc(1024, GFP_KERNEL); in lkdtm_READ_BUDDY_AFTER_FREE()
196 first = kmalloc(512, GFP_KERNEL); in lkdtm_SLAB_INIT_ON_ALLOC()
205 val = kmalloc(512, GFP_KERNEL); in lkdtm_SLAB_INIT_ON_ALLOC()
/linux-6.1.9/tools/testing/selftests/ftrace/test.d/trigger/ !
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 …
/linux-6.1.9/scripts/coccinelle/api/alloc/ !
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-6.1.9/scripts/coccinelle/api/ !
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\));
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);
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…
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-6.1.9/tools/include/linux/ !
Dslab.h11 #define kzalloc_node(size, flags, node) kmalloc(size, flags)
13 void *kmalloc(size_t size, gfp_t gfp);
28 return kmalloc(size, gfp | __GFP_ZERO); in kzalloc()
/linux-6.1.9/drivers/usb/misc/ !
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-6.1.9/scripts/coccinelle/null/ !
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-6.1.9/tools/virtio/linux/ !
Dkernel.h54 static inline void *kmalloc(size_t s, gfp_t gfp) in kmalloc() function
62 return kmalloc(n * s, gfp); in kmalloc_array()
67 void *p = kmalloc(s, gfp); in kzalloc()
75 return kmalloc(s, gfp); in alloc_pages_exact()
/linux-6.1.9/net/bluetooth/ !
Decdh_helper.c69 tmp = kmalloc(64, GFP_KERNEL); in compute_ecdh_secret()
130 tmp = kmalloc(32, GFP_KERNEL); in set_ecdh_privkey()
139 buf = kmalloc(buf_len, GFP_KERNEL); in set_ecdh_privkey()
174 tmp = kmalloc(64, GFP_KERNEL); in generate_ecdh_public_key()
/linux-6.1.9/drivers/xen/ !
Dsys-hypervisor.c104 extra = kmalloc(XEN_EXTRAVERSION_LEN, GFP_KERNEL); in extra_show()
182 info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL); in compiler_show()
200 info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL); in compiled_by_show()
218 info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL); in compile_date_show()
255 caps = kmalloc(XEN_CAPABILITIES_INFO_LEN, GFP_KERNEL); in capabilities_show()
273 cset = kmalloc(XEN_CHANGESET_INFO_LEN, GFP_KERNEL); in changeset_show()
291 parms = kmalloc(sizeof(struct xen_platform_parameters), GFP_KERNEL); in virtual_start_show()
367 buildid = kmalloc(sizeof(*buildid) + ret, GFP_KERNEL); in buildid_show()
/linux-6.1.9/lib/ !
Dtest-string_helpers.c67 char *in = kmalloc(q_real, GFP_KERNEL); in test_string_unescape()
68 char *out_test = kmalloc(q_real, GFP_KERNEL); in test_string_unescape()
69 char *out_real = kmalloc(q_real, GFP_KERNEL); in test_string_unescape()
422 char *out_test = kmalloc(out_size, GFP_KERNEL); in test_string_escape()
423 char *out_real = kmalloc(out_size, GFP_KERNEL); in test_string_escape()
424 char *in = kmalloc(256, GFP_KERNEL); in test_string_escape()
549 dst = kmalloc(len, GFP_KERNEL); in test_string_upper_lower()
567 dst = kmalloc(len, GFP_KERNEL); in test_string_upper_lower()
/linux-6.1.9/fs/ksmbd/ !
Dasn1.c107 buf = kmalloc(total_len, GFP_KERNEL); in build_spnego_ntlmssp_neg_blob()
143 buf = kmalloc(total_len, GFP_KERNEL); in build_spnego_ntlmssp_auth_blob()
217 conn->mechToken = kmalloc(vlen + 1, GFP_KERNEL); in ksmbd_neg_token_init_mech_token()
232 conn->mechToken = kmalloc(vlen + 1, GFP_KERNEL); in ksmbd_neg_token_targ_resp_token()
/linux-6.1.9/arch/mips/loongson64/ !
Dreset.c162 kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL); in mips_reboot_setup()
166 kdump_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL); in mips_reboot_setup()
170 kexec_envp = kmalloc(KEXEC_ENVP_SIZE, GFP_KERNEL); in mips_reboot_setup()
/linux-6.1.9/fs/quota/ !
Dquota_tree.c111 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in get_free_dqblk()
163 char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in remove_free_dqentry()
210 char *tmpbuf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in insert_free_dqentry()
258 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in find_free_dqentry()
332 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in do_insert_tree()
413 char *ddquot = kmalloc(info->dqi_entry_size, GFP_NOFS); in qtree_write_dquot()
452 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in free_dqentry()
516 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in remove_tree()
580 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in find_block_dqentry()
618 char *buf = kmalloc(info->dqi_usable_bs, GFP_NOFS); in find_tree_dqentry()
[all …]
/linux-6.1.9/fs/cachefiles/ !
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-6.1.9/drivers/infiniband/hw/mlx5/ !
Dmad.c317 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_ext_port_caps()
364 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_system_image_guid()
386 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_max_pkeys()
408 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_vendor_id()
431 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_node_desc()
456 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_node_guid()
482 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_pkey()
511 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_gids()
554 out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL); in mlx5_query_mad_ifc_port()
/linux-6.1.9/drivers/pci/hotplug/ !
Dcpqphp_pci.c163 fakedev = kmalloc(sizeof(*fakedev), GFP_KERNEL); in cpqhp_set_irq()
164 fakebus = kmalloc(sizeof(*fakebus), GFP_KERNEL); in cpqhp_set_irq()
733 bus_node = kmalloc(sizeof(*bus_node), GFP_KERNEL); in cpqhp_save_used_resources()
748 io_node = kmalloc(sizeof(*io_node), GFP_KERNEL); in cpqhp_save_used_resources()
764 mem_node = kmalloc(sizeof(*mem_node), GFP_KERNEL); in cpqhp_save_used_resources()
780 p_mem_node = kmalloc(sizeof(*p_mem_node), GFP_KERNEL); in cpqhp_save_used_resources()
811 io_node = kmalloc(sizeof(*io_node), in cpqhp_save_used_resources()
829 p_mem_node = kmalloc(sizeof(*p_mem_node), in cpqhp_save_used_resources()
846 mem_node = kmalloc(sizeof(*mem_node), in cpqhp_save_used_resources()
883 io_node = kmalloc(sizeof(*io_node), in cpqhp_save_used_resources()
[all …]

12345678910>>...89