• Li RongQing's avatar
    net: sysctl: fix a kmemleak warning · ce9d9b8e
    Li RongQing authored
    the returned buffer of register_sysctl() is stored into net_header
    variable, but net_header is not used after, and compiler maybe
    optimise the variable out, and lead kmemleak reported the below warning
    
    	comm "swapper/0", pid 1, jiffies 4294937448 (age 267.270s)
    	hex dump (first 32 bytes):
    	90 38 8b 01 c0 ff ff ff 00 00 00 00 01 00 00 00 .8..............
    	01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    	backtrace:
    	[<ffffffc00020f134>] create_object+0x10c/0x2a0
    	[<ffffffc00070ff44>] kmemleak_alloc+0x54/0xa0
    	[<ffffffc0001fe378>] __kmalloc+0x1f8/0x4f8
    	[<ffffffc00028e984>] __register_sysctl_table+0x64/0x5a0
    	[<ffffffc00028eef0>] register_sysctl+0x30/0x40
    	[<ffffffc00099c304>] net_sysctl_init+0x20/0x58
    	[<ffffffc000994dd8>] sock_init+0x10/0xb0
    	[<ffffffc0000842e0>] do_one_initcall+0x90/0x1b8
    	[<ffffffc000966bac>] kernel_init_freeable+0x218/0x2f0
    	[<ffffffc00070ed6c>] kernel_init+0x1c/0xe8
    	[<ffffffc000083bfc>] ret_from_fork+0xc/0x50
    	[<ffffffffffffffff>] ...
    ce9d9b8e
sysctl_net.c 2.86 KB