[ofa-general] [PATCH] libibumad 2/2: add valgrind support to the umad code
Dotan Barak
dotanb at dev.mellanox.co.il
Tue Sep 4 00:35:42 PDT 2007
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 <dotanb at dev.mellanox.co.il>
---
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);
More information about the general
mailing list