From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ray Lee" Subject: Re: Signed divides vs shifts (Re: [Security] /dev/urandom uses uninit bytes, leaks user data) Date: Mon, 17 Dec 2007 10:05:35 -0800 Message-ID: <2c0942db0712171005w65bbb512p71a4f9b1fc65c6a7@mail.gmail.com> References: <20071217185557.0b501e23.dada1@cosmosbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from ug-out-1314.google.com ([66.249.92.168]:13655 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328AbXLQSFh (ORCPT ); Mon, 17 Dec 2007 13:05:37 -0500 Received: by ug-out-1314.google.com with SMTP id z38so1601717ugc.16 for ; Mon, 17 Dec 2007 10:05:36 -0800 (PST) In-Reply-To: <20071217185557.0b501e23.dada1@cosmosbay.com> Content-Disposition: inline Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: Eric Dumazet Cc: Linus Torvalds , Herbert Xu , John Reiser , Andrew Morton , security@kernel.org, tytso@mit.edu, Linux Kernel Mailing List , mpm@selenic.com, linux-sparse@vger.kernel.org On Dec 17, 2007 9:55 AM, Eric Dumazet wrote: > - mid = (last - first) / 2 + first; > + while (low <= high) { > + mid = (low + high) / 2; I think you just introduced a bug. Think about what happens if low=high=MAX_LONG/2 + 1.