Hello. James Morris wrote:Difference between tmy_alloc() and kmalloc() are tmy_alloc() allows administrator know "how much memory is used by TOMOYO Linux modules" via /sys/kernel/security/tomoyo/meminfo interface. This feature was requested by TOMOYO Linux users. /proc/slabinfo can show how much memory is used by all modules, but it cannot show how much memory is used by TOMOYO Linux modules. tmy_alloc() can indicate memory-leaking bug and can avoid double-kfree() bug by keeping the pointer returned by kmalloc() in a local "cache_list" list. tmy_alloc() also keeps the size of memory allocated by kmalloc() in "cache_list" list so that administrator can know "how much memory is used by TOMOYO Linux modules". Calling ksize() after kmalloc() in tmy_alloc() and calling ksize() before kfree() in tmy_free() might be better if double-kfree-checks and memory-leaking-checks (i.e. "tmy_cachep") are unneeded. Regards. -
