The node_desc copy used to use sizeof, but was changed to use a constant of 64. 
 Move back to using sizeof, as it is far more maintainable.  Also add a 
C_ASSERT that the node_desc buffer is the same as the SMP data field.

Signed-off-by: Fab Tillier <[email protected]>

diff -dwup3 -X excl.txt -r 
\dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mad.c 
.\hw\mlx4\kernel\bus\ib\mad.c
--- \dev\openib\ofw\gen1\branches\mlx4_30\trunk\hw\mlx4\kernel\bus\ib\mad.c     
Thu Mar 29 00:15:28 2012
+++ .\hw\mlx4\kernel\bus\ib\mad.c       Fri Aug 10 00:31:30 2012
@@ -877,7 +877,8 @@ static void node_desc_override(struct ib
            mad->mad_hdr.method == IB_MGMT_METHOD_GET_RESP &&
            mad->mad_hdr.attr_id == IB_SMP_ATTR_NODE_DESC) {
                spin_lock(&to_mdev(dev)->sm_lock);
-               memcpy(((struct ib_smp *) mad)->data, dev->node_desc, 64);
+        C_ASSERT(sizeof(((struct ib_smp*)mad)->data) == 
sizeof(dev->node_desc));
+               memcpy(((struct ib_smp *) mad)->data, dev->node_desc, 
sizeof(dev->node_desc));
                spin_unlock(&to_mdev(dev)->sm_lock);
        }
 }

Attachment: ndv2.41.patch
Description: ndv2.41.patch

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to