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]
Date:   Wed, 06 Feb 2019 10:14:09 +0100
From:   Davide Caratti <dcaratti@...hat.com>
To:     David Ahern <dsahern@...il.com>,
        Stephen Hemminger <stephen@...workplumber.org>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next] tc: full JSON support for 'bpf' actions

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@...hat.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 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ