From patchwork Tue Jun 26 15:13:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patsy Franklin X-Patchwork-Id: 934902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-93651-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="bpLTb3mU"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41FV1s6Syvz9rxs for ; Wed, 27 Jun 2018 01:14:09 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; q=dns; s=default; b=gD9kBPOinRjn+SxJWQnxoFGhaPcPT UN9WX4AZwFdu5/B6CFU9M2DF+Vl27Kkxk17qkjE+5tNhEETK/FYnsFeVq+aXTyyv uhLj9wly/lrgCoVDPTplrr/QUi8ojejXIDNbHTyWjrVwo9PBL2hhwl1Np1Z0hMpy pP8Mr56013Q/gs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:from:date:message-id:subject:to :content-type; s=default; bh=bo4WvM8QwdgzuLcz5/p3tNWcM6A=; b=bpL Tb3mUjd43Fk/2SQapoTnr0L2LiY2mMw8B35J0C6IS7d2KEdyRdGw35TvmJVdfpoO le0juyIrXx9Ae7iAebJbgtDFiFSvN2yG5qnVHZwmAEjEQIgan2b8YmjXcBIzEhdE 0H2muz8LDM6jVeg9GsbvtHzeIWSY3dJDLVFyFf+g= Received: (qmail 48467 invoked by alias); 26 Jun 2018 15:14:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 48449 invoked by uid 89); 26 Jun 2018 15:14:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: mail-io0-f171.google.com MIME-Version: 1.0 From: Patsy Franklin Date: Tue, 26 Jun 2018 11:13:18 -0400 Message-ID: Subject: [PATCH V2] Initialize pad outside the conditional to prevent uninitialized data warnings. To: GNU C Library Updated patch attached. Reviewed-by: Carlos O'Donell commit afcfe098889bb3e5e04c662e9047f20864d55f8e Author: Patsy Franklin Date: Tue Jun 26 10:35:03 2018 -0400 In sem_open.c, pad was not initialized when __HAVE_64B_ATOMICS was true. On some arches this caused valgrind to warn about uninitialized bytes when the struct was written to the file system. This patch moves the initialization of pad outside of the conditional. diff --git a/ChangeLog b/ChangeLog index eaee727..83539e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-06-26 Patsy Franklin + + * nptl/sem_open.c [!__HAVE_64B_ATOMICS] (sem_open): Don't update pad. + (sem_open): Set sem.newsem.pad to zero for valgrind. + 2018-06-26 Florian Weimer Run thread shutdown functions in an explicit order. diff --git a/nptl/sem_open.c b/nptl/sem_open.c index 1d7f142..c5389f6 100644 --- a/nptl/sem_open.c +++ b/nptl/sem_open.c @@ -215,10 +215,11 @@ sem_open (const char *name, int oflag, ...) sem.newsem.data = value; #else sem.newsem.value = value << SEM_VALUE_SHIFT; - /* pad is used as a mutex on pre-v9 sparc and ignored otherwise. */ - sem.newsem.pad = 0; sem.newsem.nwaiters = 0; #endif + /* pad is used as a mutex on pre-v9 sparc and ignored otherwise. */ + sem.newsem.pad = 0; + /* This always is a shared semaphore. */ sem.newsem.private = FUTEX_SHARED;