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:   Tue, 14 Sep 2021 14:33:24 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     "'Fabio M. De Francesco'" <fmdefrancesco@...il.com>,
        Larry Finger <Larry.Finger@...inger.net>,
        Phillip Potter <phil@...lpotter.co.uk>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        "linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Michael Straube <straube.linux@...il.com>
CC:     Pavel Skripkin <paskripkin@...il.com>
Subject: RE: [PATCH v4 16/18] staging: r8188eu: hal: Clean up rtw_read*() and
 rtw_write*()

From: Fabio M. De Francesco
> Sent: 13 September 2021 19:10
...
> +	u16 address = (u16)(addr & 0xffff);
> 
> -	usbctrl_vendorreq(pintfhdl, wvalue, &data, 1, REALTEK_USB_VENQT_READ);
> +	usbctrl_vendorreq(intfhdl, address, &data, 1, REALTEK_USB_VENQT_READ);

You really don't need the (u16) cast or the '& 0xffff'.
The assignment will just truncate.

But do you even need to truncate the value at all?
It rather depends on what happens inside usbctrl_vendorreq()
and whether the parameter to this code is already constrained.

I think modern gcc are better, but I have seen code where
the '& 0xffff' masked the value, then the (u16) masked the
value and finally the low 16 bits were written into a structure.

(Oh the other patches are now readable - a lot of junk down the pan.)

	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