From patchwork Thu Jun 25 00:59:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland McGrath X-Patchwork-Id: 488250 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 A35DE1402E8 for ; Thu, 25 Jun 2015 10:59:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=kxZ811ap; dkim-atps=neutral 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:content-type :content-transfer-encoding:from:to:subject:message-id:date; q= dns; s=default; b=KDTVku59MYnRABKAnO+g76eSlkY8doHAT9XDNyBovcUHsp dzqkvI82ukByrJXhQ4XXyvfDL6SfRj/DIPNQYec/ApFeFFW8AmBGgNWIxina6oje FG9e0BPDpmz5Bl5amgXuUrvTN3gW3Q0FRv+Nx0pQZ3Yqayx0hsGnOZYH05Fzo= 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:content-type :content-transfer-encoding:from:to:subject:message-id:date; s= default; bh=4/AdeeT05xGN+qtxV8+Dc3POKuk=; b=kxZ811apWGHRdsHGTaRT l6IPP7Z5UFatM9CnlRjv6vPcMqu6cq5MRsVrvv8j02LBBh5qrgzpSl411U7ScsTE hvcIU91SmDvn7obTCSpFXt+aCSMoUmy3hRYrfYoen5sus3V6lq1CV1gqY/hoFIG1 foNmRnaVIWITcCBVpzdvbCI= Received: (qmail 27375 invoked by alias); 25 Jun 2015 00:59:20 -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 27358 invoked by uid 89); 25 Jun 2015 00:59:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_05, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: topped-with-meat.com MIME-Version: 1.0 From: Roland McGrath To: "GNU C. Library" Subject: [COMMITTED PATCH] Use unsigned types for counters in getaddrinfo_a code. Message-Id: <20150625005916.1983D2C3B00@topped-with-meat.com> Date: Wed, 24 Jun 2015 17:59:16 -0700 (PDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=SvUDtp+0 c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=5tJqNM6DeDJj3P-J0zUA:9 a=CjuIK1q_8ugA:10 Verified on i686-linux-gnu that no generated code changes nontrivially. Thanks, Roland * resolv/gai_misc.h (struct waitlist): Change type of field counterp to 'volatile unsigned int *'. * sysdeps/nptl/gai_misc.h (GAI_MISC_WAIT): Use unsigned types for FUTEXADDR and OLDVAL. * resolv/getaddrinfo_a.c (getaddrinfo_a): Give local variable TOTAL type 'volatile unsigned int'. (struct async_waitlist): Change type of field counter to 'unsigned int'. * resolv/gai_suspend.c (gai_suspend): Give local variable CNTR type 'unsigned int'. diff --git a/resolv/gai_misc.h b/resolv/gai_misc.h index 502cad6..92f9688 100644 --- a/resolv/gai_misc.h +++ b/resolv/gai_misc.h @@ -31,7 +31,7 @@ struct waitlist #ifndef DONT_NEED_GAI_MISC_COND pthread_cond_t *cond; #endif - volatile int *counterp; + volatile unsigned int *counterp; /* The next field is used in asynchronous `lio_listio' operations. */ struct sigevent *sigevp; /* XXX See requestlist, it's used to work around the broken signal diff --git a/resolv/gai_suspend.c b/resolv/gai_suspend.c index 26a2b4e..c3a1288 100644 --- a/resolv/gai_suspend.c +++ b/resolv/gai_suspend.c @@ -35,7 +35,7 @@ gai_suspend (const struct gaicb *const list[], int ent, pthread_cond_t cond = PTHREAD_COND_INITIALIZER; #endif int cnt; - int cntr = 1; + unsigned int cntr = 1; int none = 1; int result; diff --git a/resolv/getaddrinfo_a.c b/resolv/getaddrinfo_a.c index b7ae372..e637222 100644 --- a/resolv/getaddrinfo_a.c +++ b/resolv/getaddrinfo_a.c @@ -28,7 +28,7 @@ /* We need this special structure to handle asynchronous I/O. */ struct async_waitlist { - int counter; + unsigned int counter; struct sigevent sigev; struct waitlist list[0]; }; @@ -40,7 +40,7 @@ getaddrinfo_a (int mode, struct gaicb *list[], int ent, struct sigevent *sig) struct sigevent defsigev; struct requestlist *requests[ent]; int cnt; - volatile int total = 0; + volatile unsigned int total = 0; int result = 0; /* Check arguments. */ diff --git a/sysdeps/nptl/gai_misc.h b/sysdeps/nptl/gai_misc.h index bb83dca..a34dbc0 100644 --- a/sysdeps/nptl/gai_misc.h +++ b/sysdeps/nptl/gai_misc.h @@ -35,8 +35,8 @@ #define GAI_MISC_WAIT(result, futex, timeout, cancel) \ do { \ - volatile int *futexaddr = &futex; \ - int oldval = futex; \ + volatile unsigned int *futexaddr = &futex; \ + unsigned int oldval = futex; \ \ if (oldval != 0) \ { \