Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 5 Mar 2002 20:43:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 5 Mar 2002 20:43:18 -0500 Received: from sydney1.au.ibm.com ([202.135.142.193]:25362 "EHLO haven.ozlabs.ibm.com") by vger.kernel.org with ESMTP id ; Tue, 5 Mar 2002 20:43:08 -0500 From: Rusty Russell To: Davide Libenzi Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Futexes IV (Fast Lightweight Userspace Semaphores) In-Reply-To: Your message of "Tue, 05 Mar 2002 14:39:53 -0800." Date: Wed, 06 Mar 2002 12:46:25 +1100 Message-Id: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org In message y ou write: > On Tue, 5 Mar 2002, Rusty Russell wrote: > > > + pos_in_page = ((unsigned long)uaddr) % PAGE_SIZE; > > + > > + /* Must be "naturally" aligned, and not on page boundary. */ > > + if ((pos_in_page % __alignof__(atomic_t)) != 0 > > + || pos_in_page + sizeof(atomic_t) > PAGE_SIZE) > > + return -EINVAL; > > How can this : > > (pos_in_page % __alignof__(atomic_t)) != 0 > > to be false, and together this : > > pos_in_page + sizeof(atomic_t) > PAGE_SIZE > > to be true ? You're assuming that __alignof__(atomic_t) = N * sizeof(atomic_t), where N is an integer. If alignof == 1, and sizeof == 4, you lose. I prefer to be future-proof. This means I should clarify the comment... Rusty. -- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. - 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/