From patchwork Mon Jul 4 09:53:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sebastien dugue X-Patchwork-Id: 942022 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p64AFnmJ001837 for ; Mon, 4 Jul 2011 10:15:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757204Ab1GDKPs (ORCPT ); Mon, 4 Jul 2011 06:15:48 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:55769 "EHLO ecfrec.frec.bull.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757186Ab1GDKPs (ORCPT ); Mon, 4 Jul 2011 06:15:48 -0400 Received: from cyclope.frec.bull.fr (cyclope.frec.bull.fr [129.183.4.9]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 903886F598; Mon, 4 Jul 2011 11:45:25 +0200 (CEST) Received: from b012350-ux (b012350-ux.frec.bull.fr [129.183.101.36]) by cyclope.frec.bull.fr (Postfix) with ESMTP id 51422272C8; Mon, 4 Jul 2011 11:45:24 +0200 (CEST) Date: Mon, 4 Jul 2011 11:53:14 +0200 From: sebastien dugue To: linux-rdma Cc: Alex Netes , Vincent Subject: [PATCH] umad.c: memset() ib_user_mad_reg_req structure to 0 before invoking ioctl() Message-ID: <20110704115314.7c15c6ac@b012350-ux> Organization: BULL X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 04 Jul 2011 10:15:49 +0000 (UTC) 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 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;