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: <20161014.160625.256367812856122638.davem@davemloft.net>
Date:   Fri, 14 Oct 2016 16:06:25 -0400 (EDT)
From:   David Miller <davem@...emloft.net>
To:     jesse.brandeburg@...el.com
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH NET] ethtool: silence warning on bit loss

From: Jesse Brandeburg <jesse.brandeburg@...el.com>
Date: Thu, 13 Oct 2016 16:13:55 -0700

> Sparse was complaining when we went to prototype some code
> using ethtool_cmd_speed_set and SPEED_100000, which uses
> the upper 16 bits of __u32 speed for the first time.
> 
> CHECK
> ...
> .../uapi/linux/ethtool.h:123:28: warning:
>   cast truncates bits from constant value (186a0 becomes 86a0)
> 
> The warning is actually bogus, as no bits are really lost, but
> we can get rid of the sparse warning with this one small change.
> 
> Reported-by: Preethi Banala <preethi.banala@...el.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@...el.com>

Ok, I'll apply this.

There were alternative suggestions but I like this patch
because it makes it explicit what is going on.

Just removing the u16 cast requires the reader to implicitly
understand and know the types in the structure.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ