From patchwork Wed Apr 18 18:33:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 153562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5453BB6FBB for ; Thu, 19 Apr 2012 04:33:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754270Ab2DRSdb (ORCPT ); Wed, 18 Apr 2012 14:33:31 -0400 Received: from mail.vyatta.com ([76.74.103.46]:41181 "EHLO mail.vyatta.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754241Ab2DRSda (ORCPT ); Wed, 18 Apr 2012 14:33:30 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.vyatta.com (Postfix) with ESMTP id 89015141004C; Wed, 18 Apr 2012 11:33:29 -0700 (PDT) X-Virus-Scanned: amavisd-new at tahiti.vyatta.com Received: from mail.vyatta.com ([127.0.0.1]) by localhost (mail.vyatta.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CHc+cV+L61U1; Wed, 18 Apr 2012 11:33:28 -0700 (PDT) Received: from nehalam.linuxnetplumber.net (static-50-53-80-93.bvtn.or.frontiernet.net [50.53.80.93]) by mail.vyatta.com (Postfix) with ESMTPSA id A7BF21410041; Wed, 18 Apr 2012 11:33:28 -0700 (PDT) Date: Wed, 18 Apr 2012 11:33:27 -0700 From: Stephen Hemminger To: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org Subject: libmnl: fix valgrind warnings about padding Message-ID: <20120418113327.3d26501b@nehalam.linuxnetplumber.net> Organization: Vyatta X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org When using mnl_nlmsg_put_extra_header() it pads out the addtional header but only zeros the original size not the padded value. Which cause valgrind to complain about sendto() with unitialized byte. --- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/src/nlmsg.c +++ b/src/nlmsg.c @@ -105,8 +105,9 @@ void * mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, size_t size) { char *ptr = (char *)nlh + nlh->nlmsg_len; - nlh->nlmsg_len += MNL_ALIGN(size); - memset(ptr, 0, size); + size_t len = MNL_ALIGN(size); + nlh->nlmsg_len += len; + memset(ptr, 0, len); return ptr; } EXPORT_SYMBOL(mnl_nlmsg_put_extra_header);