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: <ef8069e60f7a4e23a26dcbedd0bc77d7@AcuMS.aculab.com>
Date:   Fri, 10 Jun 2022 07:19:38 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Nick Desaulniers' <ndesaulniers@...gle.com>,
        Al Viro <viro@...iv.linux.org.uk>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Justin Stitt <jstitt007@...il.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Tom Rix <trix@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
        Richard Smith <richardsmith@...gle.com>
Subject: RE: [PATCH] include/uapi/linux/swab.h: add __u16 cast to __swab16
 conditional

From: Nick Desaulniers
> Sent: 08 June 2022 20:35
....
> The issue we're facing is more so that `ntohs` is being used in
> printf-like expressions; clang's -Wformat warns about default argument
> promotion so we need to clean up cases where smaller-than-int format
> flags are being used for promoted-to-int params.  While looking at
> that, Nathan noticed that __swab16 will return either a __u16 or an
> int based on whether __HAVE_BUILTIN_BSWAP16__ is defined, which
> depends on BOTH the compiler being used and target architecture.  This
> patch from Justin just cleans that up.

The 'problem' is that the (__u16) cast is likely to add an
extra '& 0xffff' instruction that is almost certainly not
required.

OTOH the lack of this masking has always been a difference between
htons() on BE and LE systems.

But clang is also being over-enthusiastic with its warnings.
IIRC varargs parameters always get integer promotion.
So if %hd ever makes sense for printf then it implies a
mask inside printf.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ