bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bo YU <tsu.yubo@gmail.com>
To: Quentin Monnet <quentin.monnet@netronome.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>,
	songliubraving@fb.com, Yonghong Song <yhs@fb.com>,
	jakub.kicinski@netronome.com, df@google.com,
	Netdev <netdev@vger.kernel.org>,
	bpf@vger.kernel.org, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bpf: bpftool: convert ‘const char *’ type into 'char *' in assignment
Date: Thu, 28 Mar 2019 22:38:15 +0800	[thread overview]
Message-ID: <CAKq8=3LSoSq1CPUo=g8GQSsi0HC9s+ewWEcxKk6uhHARyP_phg@mail.gmail.com> (raw)
In-Reply-To: <d870f83e-48fa-7372-7664-e268aa1acf6c@netronome.com>

On Thu, Mar 28, 2019 at 10:33 PM Quentin Monnet
<quentin.monnet@netronome.com> wrote:
>
> 2019-03-28 10:16 UTC-0400 ~ Bo YU <tsu.yubo@gmail.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.
> >
> > Fixes:3ddeac6705aba(tools: bpftool: use 4 context mode for the NFP disasm)
> > Signed-off-by: Bo YU <tsu.yubo@gmail.com>
> > ---
> > 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;
> >
>
>
> Hi, the warning does not show with latest versions of binutils, it was
> fixed with this (binutils) commit:
>
>     commit f995bbe8e62fdb5607acb1ee127240cfe50d2b8f
>     Author: Pedro Alves <palves@redhat.com>
>     Date:   Wed Apr 5 19:21:33 2017 +0100
>
>         -Wwrite-strings: Constify struct disassemble_info's
>                 disassembler_options field
>
> Distributions with recent binutils (Ubuntu 18.04, Fedora 29 at least)
> should not have this message. I thought about sending the same patch
> some time ago, but in the end Jakub and I decided that it may not be
> worth casting the const away to silence the warning just for older
> distributions. Daniel also shared the same opinion at the time (but that
> was off the mailing-list).
Ok, good to know it.
Thanks,
>
> Quentin

  reply	other threads:[~2019-03-28 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-28 14:16 [PATCH] bpf: bpftool: convert ‘const char *’ type into 'char *' in assignment Bo YU
2019-03-28 14:30 ` Quentin Monnet
2019-03-28 14:38   ` Bo YU [this message]
2019-03-28 15:08   ` David Laight
2019-03-28 15:58     ` Quentin Monnet
2019-03-28 14:36 ` Mukesh Ojha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKq8=3LSoSq1CPUo=g8GQSsi0HC9s+ewWEcxKk6uhHARyP_phg@mail.gmail.com' \
    --to=tsu.yubo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=df@google.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.monnet@netronome.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).