Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756181Ab0FIW22 (ORCPT ); Wed, 9 Jun 2010 18:28:28 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:51770 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755717Ab0FIW20 (ORCPT ); Wed, 9 Jun 2010 18:28:26 -0400 Date: Wed, 9 Jun 2010 15:27:37 -0700 (PDT) From: Linus Torvalds To: Peter Zijlstra cc: Salman , akpm@linux-foundation.org, mingo@elte.hu, linux-kernel@vger.kernel.org, tytso@google.com Subject: Re: [PATCH] Fix a race in pid generation that causes pids to be reused immediately. In-Reply-To: Message-ID: References: <20100609210014.7464.92234.stgit@bumblebee1.mtv.corp.google.com> <1276119207.1745.154.camel@laptop> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 730 Lines: 20 On Wed, 9 Jun 2010, Linus Torvalds wrote: > > Quite possibly. I'd worry about the overflow case a bit, but it's > certainly going to get the right value when base << MAX_INT. Having given it a couple of seconds more thought, I don't think there is an overflow case either. All of a/b/base are guaranteed to be non-negative (or our pid code is in worse trouble anyway), so there is no overflow possible. So yes. Just comparing a-base < b-base should always be safe. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/