From owner-svn-src-all@freebsd.org Thu Sep 10 10:23:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41723A00817; Thu, 10 Sep 2015 10:23:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 322EA13BA; Thu, 10 Sep 2015 10:23:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8AANOt3027722; Thu, 10 Sep 2015 10:23:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8AANOwc027721; Thu, 10 Sep 2015 10:23:24 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201509101023.t8AANOwc027721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 10 Sep 2015 10:23:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287619 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2015 10:23:24 -0000 Author: tuexen Date: Thu Sep 10 10:23:23 2015 New Revision: 287619 URL: https://svnweb.freebsd.org/changeset/base/287619 Log: Zero out a local variable also when PURIFY is not defined. This silence a warning brought up by valgrind whenever if_nametoindex is used. This was already discussed in PR 166483, but the code committed in r234329 guards the initilization with #ifdef PURIFY. Therefore, valgrind still complains. Since this code is not performance critical, always zero out the local variable to silence valgrind. PR: 166483 Discussed with: eadler@ MFC after: 4 weeks Modified: head/lib/libc/net/if_nametoindex.c Modified: head/lib/libc/net/if_nametoindex.c ============================================================================== --- head/lib/libc/net/if_nametoindex.c Thu Sep 10 09:27:22 2015 (r287618) +++ head/lib/libc/net/if_nametoindex.c Thu Sep 10 10:23:23 2015 (r287619) @@ -70,9 +70,7 @@ if_nametoindex(const char *ifname) s = _socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (s != -1) { -#ifdef PURIFY memset(&ifr, 0, sizeof(ifr)); -#endif strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (_ioctl(s, SIOCGIFINDEX, &ifr) != -1) { _close(s);