Re: [PATCH] bpf: bpftool: convert âconst char *â type into 'char *' in assignment

From: Mukesh Ojha
Date: Thu Mar 28 2019 - 10:36:30 EST



On 3/28/2019 7:46 PM, Bo YU wrote:
When compiling with check flag: make -C tools/bpf/bpftool/
gcc will warning:

jit_disasm.c:119:29: warning: assignment discards âconstâ qualifier from pointer target type [-Wdiscarded-qualifiers]
 info.disassembler_options = disassembler_options;

So convert 'const char *' type into 'char *' to fix the warning.

Fixes:3ddeac6705aba(tools: bpftool: use 4 context mode for the NFP disasm)
Signed-off-by: Bo YU <tsu.yubo@xxxxxxxxx>


Reviewed-by: Mukesh Ojha <mojha@xxxxxxxxxxxxxx>

-Mukesh

---
tools/bpf/bpftool/jit_disasm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c
index 3ef3093560ba..40b46e46454a 100644
--- a/tools/bpf/bpftool/jit_disasm.c
+++ b/tools/bpf/bpftool/jit_disasm.c
@@ -116,7 +116,7 @@ void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
ÂÂÂÂinfo.arch = bfd_get_arch(bfdf);
ÂÂÂÂinfo.mach = bfd_get_mach(bfdf);
ÂÂÂÂif (disassembler_options)
-ÂÂÂÂÂÂÂ info.disassembler_options = disassembler_options;
+ÂÂÂÂÂÂÂ info.disassembler_options = (char *)disassembler_options;
ÂÂÂÂinfo.buffer = image;
ÂÂÂÂinfo.buffer_length = len;