Added valgrind support to the umad code and marked buffers that were filled
by the kernel level with the macro VALGRIND_MAKE_MEM_DEFINED.

Signed-off-by: Dotan Barak <[EMAIL PROTECTED]>

---

Index: connectx_user/src/userspace/management/libibumad/src/umad.c
===================================================================
--- connectx_user.orig/src/userspace/management/libibumad/src/umad.c    
2007-09-02 08:01:42.000000000 +0300
+++ connectx_user/src/userspace/management/libibumad/src/umad.c 2007-09-04 
10:25:56.000000000 +0300
@@ -51,6 +51,20 @@
 
 #define IB_OPENIB_OUI                 (0x001405)
 
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+
+#  include <valgrind/memcheck.h>
+
+#  ifndef VALGRIND_MAKE_MEM_DEFINED
+#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_DEFINED not 
available"
+#  endif
+
+#endif /* HAVE_VALGRIND_MEMCHECK_H */
+
+#ifndef VALGRIND_MAKE_MEM_DEFINED
+#  define VALGRIND_MAKE_MEM_DEFINED(addr,len)
+#endif
+
 typedef struct ib_user_mad_reg_req {
        uint32_t id;
        uint32_t method_mask[4];
@@ -926,6 +940,8 @@ umad_register(int portid, int mgmt_class
 
        memcpy(&req.oui, (char *)&oui + 1, sizeof req.oui);
 
+       VALGRIND_MAKE_MEM_DEFINED(&req, sizeof req);
+
        if (!ioctl(port->dev_fd, IB_USER_MAD_REGISTER_AGENT, (void *)&req)) {
                DEBUG("portid %d registered to use agent %d qp %d",
                      portid, req.id, qp);
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to