netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: mlx4_en: fix endianness with blue frame support
@ 2012-09-18  7:34 Dan Carpenter
  2012-09-20 13:46 ` Or Gerlitz
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-09-18  7:34 UTC (permalink / raw)
  To: cascardo; +Cc: netdev

Hello Thadeu Lima de Souza Cascardo,

The patch c5d6136e10d6: "mlx4_en: fix endianness with blue frame 
support" from Oct 10, 2011, leads to the following warning:
drivers/net/ethernet/mellanox/mlx4/en_tx.c:720 mlx4_en_xmit()
	 warn: potential memory corrupting cast. 4 vs 2 bytes

That patch introduced a call to cpu_to_be32() and added some endian
notation.

	*(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);

But it doesn't make sense because the data type is declared as u16 in
the header and we would be corrupting the next elements in the struct
which are ins_vlan and fence_size.

struct mlx4_wqe_ctrl_seg {
        __be32                  owner_opcode;
        __be16                  vlan_tag;
        u8                      ins_vlan;
        u8                      fence_size;

I guess the reason we get away with it is that the ->doorbell_qpn is
normally less that 65k. But doorbell_qpn is a u32 type so I think there
is a risk here.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-24 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18  7:34 mlx4_en: fix endianness with blue frame support Dan Carpenter
2012-09-20 13:46 ` Or Gerlitz
2012-09-24 19:42   ` Dan Carpenter

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).