From: Davide Caratti <dcaratti@redhat.com>
To: David Ahern <dsahern@gmail.com>,
Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] tc: full JSON support for 'bpf' actions
Date: Wed, 06 Feb 2019 10:14:09 +0100 [thread overview]
Message-ID: <11011cbd34985d06aef95165aa4d879980cb32c7.camel@redhat.com> (raw)
In-Reply-To: <fa55aa0f-b40f-fec3-2626-4a23e73fd1aa@gmail.com>
On Tue, 2019-02-05 at 14:59 -0800, David Ahern wrote:
> On 2/5/19 2:53 PM, Stephen Hemminger wrote:
> > On Thu, 31 Jan 2019 18:58:09 +0100
> > Davide Caratti <dcaratti@redhat.com> wrote:
> >
> > > + print_uint(PRINT_ANY, "code", "%hu ", ops[i].code);
> > > + print_uint(PRINT_ANY, "jt", "%hhu ", ops[i].jt);
> > > + print_uint(PRINT_ANY, "jf", "%hhu ", ops[i].jf);
> >
> > Did you know that print_uint promotes the argument to unsigned int
this happens frequently in iproute2 code,
> > then you are printing it with %hhu which expects only a u8.
but indeed, %hu and %hhu made the former cast just useless: thanks for
noticing.
> I did look at the print_hhu option and it seems really weird that you
> use "print_hhu(..., "%hhu", ...)" which is why I took the patch as is.
> There are existing examples of print_uint with '%hu' too.
> The print_ functions really should be renamed (print_uchar,
> print_ushort, etc).
maybe this can be done more reliably with an automatic tool, like
coccinelle. There are only 5 lines with the print_uint(...
"%hu" ...) pattern, so this can be uniformed easily with a small patch.
--
davide
prev parent reply other threads:[~2019-02-06 9:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-31 17:58 [PATCH iproute2-next] tc: full JSON support for 'bpf' actions Davide Caratti
2019-02-03 17:11 ` David Ahern
2019-02-05 22:53 ` Stephen Hemminger
2019-02-05 22:59 ` David Ahern
2019-02-06 9:14 ` Davide Caratti [this message]
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=11011cbd34985d06aef95165aa4d879980cb32c7.camel@redhat.com \
--to=dcaratti@redhat.com \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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).