lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4c015f97-b5f0-68a0-2a6b-9333fe1bcb62@netronome.com>
Date:   Thu, 28 Mar 2019 15:58:13 +0000
From:   Quentin Monnet <quentin.monnet@...ronome.com>
To:     David Laight <David.Laight@...LAB.COM>,
        "ast@...nel.org" <ast@...nel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>,
        "kafai@...com" <kafai@...com>,
        "songliubraving@...com" <songliubraving@...com>,
        "yhs@...com" <yhs@...com>,
        "jakub.kicinski@...ronome.com" <jakub.kicinski@...ronome.com>,
        "df@...gle.com" <df@...gle.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] bpf: bpftool: convert ‘const char *’ type into 'char *' in assignment

2019-03-28 15:08 UTC+0000 ~ David Laight <David.Laight@...LAB.COM>
> From: Quentin Monnet
>> Sent: 28 March 2019 14:31
>> 2019-03-28 10:16 UTC-0400 ~ Bo YU <tsu.yubo@...il.com>
>>> 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.
>>>
> ...
>>> --- 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;
> 
> At some point someone may decide to build with -Wcast-const
> at which point you've just generated a different error.
> 
> The (probably) correct fix is to make info.disassempler_options 'const char *'.
> 
> 	David
> 

Which is what this binutils commit I cited does :)

Quentin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ