[Skiboot] [PATCH 1/2] platforms/ibm-fsp: Fix incorrect struct member access and comparison

Russell Currey ruscur at russell.cc
Mon Jul 18 15:37:52 AEST 2016


On Mon, 2016-07-18 at 15:26 +1000, Suraj Jitindar Singh wrote:
> For a 1004 slot mapping bit 6 (0x40) of the P0 field represents the
> pwr_ctl bit. This code previously accessed the wrong field (power_ctl)
> which is a single bit which corresponds to the 1005 mapping (which is
> the wrong mapping), performed a bitwise and with 0x40 (which will always
> be 0), and then compared to 1 (which will also always be 0).
> 
> Fix this to access the byte struct member, bitwise and with 0x40 to mask
> the power_ctl bit, and double negate to guarantee 0 or 1 result.
> 
> Fixes: 6884fe63 ("platforms/ibm-fsp: Support PCI slot")
> 
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh at gmail.com>
> Acked-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
> ---

Probably worth mentioning that this was found by Coverity Scan, is that correct?

Reviewed-by: Russell Currey <ruscur at russell.cc>


More information about the Skiboot mailing list