kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: mlx4_en: Using blue flame support
@ 2013-12-17 11:57 Dan Carpenter
  2013-12-17 12:55 ` Amir Vadai
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-12-17 11:57 UTC (permalink / raw)
  To: kernel-janitors

Hello Yevgeny Petrilin,

The patch 87a5c3896f9c: "mlx4_en: Using blue flame support" from
Mar 22, 2011, leads to the following static checker warning:

	drivers/net/ethernet/mellanox/mlx4/en_tx.c:839 mlx4_en_xmit()
	warn: potential memory corrupting cast 4 vs 2 bytes

drivers/net/ethernet/mellanox/mlx4/en_tx.c
   771          tx_desc->ctrl.ins_vlan = MLX4_WQE_CTRL_INS_VLAN *
   772                  !!vlan_tx_tag_present(skb);
   773          tx_desc->ctrl.fence_size = (real_size / 16) & 0x3f;

We set ->ctrl.ins_vlan and ->ctrl.fence_size here.

   774          tx_desc->ctrl.srcrb_flags = priv->ctrl_flags;
   775          if (likely(skb->ip_summed = CHECKSUM_PARTIAL)) {
   776                  tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM |
   777                                                           MLX4_WQE_CTRL_TCP_UDP_CSUM);
   778                  ring->tx_csum++;
   779          }

[ snip ]

   838          if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tx_tag_present(skb)) {
   839                  *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);

And then sometimes we overwrite them here.  It's not clear if this is
deliberate or accidental.  Maybe add a comment?

   840                  op_own |= htonl((bf_index & 0xffff) << 8);
   841                  /* Ensure new descirptor hits memory
   842                  * before setting ownership of this descriptor to HW */
   843                  wmb();
   844                  tx_desc->ctrl.owner_opcode = op_own;
   845  
   846                  wmb();

regards,
dan carpenter


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

* Re: mlx4_en: Using blue flame support
  2013-12-17 11:57 mlx4_en: Using blue flame support Dan Carpenter
@ 2013-12-17 12:55 ` Amir Vadai
  0 siblings, 0 replies; 2+ messages in thread
From: Amir Vadai @ 2013-12-17 12:55 UTC (permalink / raw)
  To: kernel-janitors

On 17/12/2013 13:57, Dan Carpenter wrote:
>    838          if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tx_tag_present(skb)) {
>    839                  *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);
> 
> And then sometimes we overwrite them here.  It's not clear if this is
> deliberate or accidental.  Maybe add a comment?

Yes, this is deliberate.
I will send a patch to make it clearer.

Amir

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

end of thread, other threads:[~2013-12-17 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-17 11:57 mlx4_en: Using blue flame support Dan Carpenter
2013-12-17 12:55 ` Amir Vadai

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