libbpf: Avoid allocating reg_name with sscanf in parse_usdt_arg()
authorXu Kuohai <xukuohai@huawei.com>
Tue, 18 Oct 2022 14:55:38 +0000 (10:55 -0400)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 21 Oct 2022 21:28:14 +0000 (14:28 -0700)
commitd9740535b857650bd6211a67ac0c0d574cba1dce
tree901bf64f17d5db7d104d9537327414e93700c42b
parenteb814cf1adea0ce24413c26c22e9f1a556a45d34
libbpf: Avoid allocating reg_name with sscanf in parse_usdt_arg()

The reg_name in parse_usdt_arg() is used to hold register name, which
is short enough to be held in a 16-byte array, so we could define
reg_name as char reg_name[16] to avoid dynamically allocating reg_name
with sscanf.

Suggested-by: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20221018145538.2046842-1-xukuohai@huaweicloud.com
tools/lib/bpf/usdt.c