From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119203 invoked by alias); 17 Mar 2018 00:26:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 119192 invoked by uid 89); 17 Mar 2018 00:26:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*r:sk:zimbra., H*RU:sk:zimbra., HX-HELO:sk:zimbra., Hx-spam-relays-external:sk:zimbra. X-HELO: zimbra.cs.ucla.edu Subject: Re: Fix signed integer overflow in random_r (bug 17343) To: Joseph Myers , libc-alpha@sourceware.org References: From: Paul Eggert Message-ID: Date: Sat, 17 Mar 2018 00:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2018-03/txt/msg00418.txt.bz2 Joseph Myers wrote: > int32_t val = state[0]; > - val = ((state[0] * 1103515245) + 12345) & 0x7fffffff; > + val = ((state[0] * 1103515245U) + 12345U) & 0x7fffffff; The first assignment to VAL (in the unchanged line) is unnecessary; I suggest coalescing the two lines.