linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* qla3xxx: u32 constant overflow in fm93c56a_select()
@ 2017-01-15 12:03 Nicolas Iooss
  0 siblings, 0 replies; only message in thread
From: Nicolas Iooss @ 2017-01-15 12:03 UTC (permalink / raw)
  To: Dept-GELinuxNICDev, netdev; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-15 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-15 12:03 qla3xxx: u32 constant overflow in fm93c56a_select() Nicolas Iooss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).