qla3xxx: u32 constant overflow in fm93c56a_select()
From: Nicolas Iooss
Date: Sun Jan 15 2017 - 07:04:10 EST
Hello,
In drivers/net/ethernet/qlogic/qla3xxx.c, fm93c56a_select() currently calls:
ql_write_nvram_reg(qdev, spir,
((ISP_NVRAM_MASK << 16) | qdev->eeprom_cmd_data));
and ISP_NVRAM_MASK is defined as (0x000F << 16).
ql_write_nvram_reg() writes a 32-bit value but (ISP_NVRAM_MASK << 16)
expands to ((0x000F << 16) << 16) = 0xF << 32, which overflows the u32
type. This means the above call is equivalent to:
ql_write_nvram_reg(qdev, spir, qdev->eeprom_cmd_data);
Is this something normal, in which case (ISP_NVRAM_MASK << 16) would be
removed, or a bug?
Thanks,
Nicolas