From patchwork Thu Jun 23 17:34:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 639795 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rb7rF6jt3z9sdm for ; Fri, 24 Jun 2016 03:34:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751784AbcFWRee (ORCPT ); Thu, 23 Jun 2016 13:34:34 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:44341 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750979AbcFWRed (ORCPT ); Thu, 23 Jun 2016 13:34:33 -0400 Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id 6DEA467398; Thu, 23 Jun 2016 19:35:52 +0200 (CEST) Received: from xsao (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id 4CC5B67998; Thu, 23 Jun 2016 19:35:52 +0200 (CEST) From: Phil Sutter To: Stephen Hemminger Cc: Daniel Borkmann , David Ahern , Nicolas Dichtel , Julien Floret , netdev@vger.kernel.org Subject: [iproute PATCH v3 4/6] No need to initialize rtattr fields before parsing Date: Thu, 23 Jun 2016 19:34:12 +0200 Message-Id: <1466703254-5174-5-git-send-email-phil@nwl.cc> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1466703254-5174-1-git-send-email-phil@nwl.cc> References: <1466703254-5174-1-git-send-email-phil@nwl.cc> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since parse_rtattr_flags() calls memset already, there is no need for callers to do so themselves. Signed-off-by: Phil Sutter --- ip/ipaddress.c | 2 +- tc/tc_class.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 62856f2c26eba..703a56b88d257 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -439,7 +439,7 @@ static void print_num(FILE *fp, unsigned int width, uint64_t count) static void print_vf_stats64(FILE *fp, struct rtattr *vfstats) { - struct rtattr *vf[IFLA_VF_STATS_MAX + 1] = {}; + struct rtattr *vf[IFLA_VF_STATS_MAX + 1]; if (vfstats->rta_type != IFLA_VF_STATS) { fprintf(stderr, "BUG: rta type is %d\n", vfstats->rta_type); diff --git a/tc/tc_class.c b/tc/tc_class.c index 158b4b18506eb..0d6000b91f539 100644 --- a/tc/tc_class.c +++ b/tc/tc_class.c @@ -219,7 +219,7 @@ static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list, { struct hlist_node *n, *tmp_cls; char cls_id_str[256] = {}; - struct rtattr *tb[TCA_MAX + 1] = {}; + struct rtattr *tb[TCA_MAX + 1]; struct qdisc_util *q; char str[100] = {}; @@ -304,7 +304,7 @@ int print_class(const struct sockaddr_nl *who, FILE *fp = (FILE *)arg; struct tcmsg *t = NLMSG_DATA(n); int len = n->nlmsg_len; - struct rtattr *tb[TCA_MAX + 1] = {}; + struct rtattr *tb[TCA_MAX + 1]; struct qdisc_util *q; char abuf[256];