On Mon, Jul 4, 2011 at 11:53 AM, sebastien dugue <[email protected]> wrote: > > This fixes the following warning issued by valgrind: > > ==5287== Syscall param ioctl(generic) points to uninitialised byte(s) > ==5287== at 0x3C466D95D7: ioctl (in /lib64/libc-2.12.so) > ==5287== by 0x526C292: umad_register (umad.c:947) > ==5287== by 0x568D206: smp_engine_init (query_smp.c:228) > ==5287== by 0x5689F8F: ibnd_discover_fabric (ibnetdisc.c:537) > ==5287== by 0x411700: devmgr_discover_fabric (devmgr_discover.c:66) > > Signed-off-by: Jean-Vincent Ficet <[email protected]> > > --- > > diff --git a/src/umad.c b/src/umad.c > index 45a9423..cac46a4 100644 > --- a/src/umad.c > +++ b/src/umad.c > @@ -892,6 +892,7 @@ int umad_register_oui(int fd, int mgmt_class, uint8_t > rmpp_version, > return -EINVAL; > } > > + memset(&req, 0, sizeof(req)); > req.qpn = 1; > req.mgmt_class = mgmt_class; > req.mgmt_class_version = 1; > @@ -928,6 +929,7 @@ int umad_register(int fd, int mgmt_class, int > mgmt_version, > ("fd %d mgmt_class %u mgmt_version %u rmpp_version %d method_mask > %p", > fd, mgmt_class, mgmt_version, rmpp_version, method_mask); > > + memset(&req, 0, sizeof(req)); > req.qpn = qp = (mgmt_class == 0x1 || mgmt_class == 0x81) ? 0 : 1; > req.mgmt_class = mgmt_class; > req.mgmt_class_version = mgmt_version;
A possible alternative approach is to develop a patch for Valgrind that makes Valgrind ignore padding fields and/or output fields in the pre-ioctl check. See also PRE(sys_ioctl) in source file coregrind/m_syswrap/syswrap-linux.c or the documentation file README_MISSING_SYSCALL_OR_IOCTL. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
