From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 326D664 for ; Wed, 24 Jun 2026 00:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782259481; cv=none; b=aiZ8mJ6wdfjKnz/QF+uGwT9gO0nqo+k76Yn8wacnlU8Jrfl9lTSkIFb8VSGv5/OPeYZFlmGDQIK9IwegMhJUYblQSHBk1VqtgMuE2L4PKcWs969KGlezX4OqZr8BQyy5Jft62f4dJQB1pJOmReS+2LMNWxwUJHBOG+cPfSajvqo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782259481; c=relaxed/simple; bh=bVYnFzumGO/dS7vuBvXxeKzu73BhQenNb7YcC/8I3zM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BzyPAiEd/4lwm3OnKIz9nCr7ZAfi5OQNc2hYOT/rbSPRCfu/i4GlzjMgDpMtD4PucGoWVKIru2BAJJacvyosIesGGd7Qvz2HJy9xOXiB8D8mi9+7r/GYq8nipKUQ4Vp9daEcK0hTEF0SWdzpqv/r7BQ1vXC+2RaGIbpywGCwQGk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=Gs5H21tQ; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="Gs5H21tQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Z03q1EJsWn/u3b39jWMHKzAGgw7/SB8N3H1MvGcKLPU=; b=Gs5H21tQDgYPx4RJZ/+HND7HcS KRiZrlsv3rNVigHFrHei1jcBIuGv+PvfKpp4FF1amXmRRHTycOhxUfOItNVbLLsTa0tXqoTjXRiJv dhhGBeK2fd08M1lU4G0hMlCJOIONNYBPGBDBtt8RMnLqNicS62QoPq2mPy5kuvoVSSa+ru94RRzjZ ex05BMr3Q300j7z2WnBN5fD/9nhAZEEe3uF85sl6ijWuHjQwlbO3fmWBlhclz20SG8Oios5XeVZRX x9FS7Er8hhEvr8vaNCCcyvkKudjUTPc8SOrdhZwWp8c86e0gn5dJ8k3GM0MgkaLzYClc7O6iQCwms yLVisTEg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.99.4 #2 (Red Hat Linux)) id 1wcB6a-00000001BAe-43gD; Wed, 24 Jun 2026 00:04:37 +0000 Date: Wed, 24 Jun 2026 01:04:36 +0100 From: Al Viro To: Ben Dooks Cc: Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib/iomem_copy: fix __iomem casts Message-ID: <20260624000436.GH2636677@ZenIV> References: <20260622124857.379868-1-ben.dooks@codethink.co.uk> <20260623234720.GG2636677@ZenIV> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260623234720.GG2636677@ZenIV> Sender: Al Viro On Wed, Jun 24, 2026 at 12:47:20AM +0100, Al Viro wrote: > On Mon, Jun 22, 2026 at 01:48:57PM +0100, Ben Dooks wrote: > > The iomem_copy.c code discards __iomem address space when using > > the IS_ALIGNED() macro. It would make more sense to fix this in > > one place by aing a PTR_ALIGNED_LONG() macro and then doing the > > necessary casts there before invoking IS_ALIGNED(). > > > > As part of this, also force the pointer to an unsigned long as > > pointers are generally not signed, although there is no warning > > as yet on treating pointers as signed. > > > +#define PTR_ALIGNED_LONG(__ptr) IS_ALIGNED((__force unsigned long)__ptr, sizeof(long)) > > Casting to unsigned long is fine (indeed, casting a pointer to long had > been very odd in the first place), but... why __force? Casts to unsigned long > (de facto uintptr_t) do *not* require __force - they are explicitly allowed, > unless you pass -Wcast-from-as in sparse arguments. -Wall does not turn > those on; -Wsparse-all would, but kbuild doesn't pass that. FWIW, we have 170+ places where IS_ALIGNED((unsigned long)pointer, _) or IS_ALIGNED((uintptr_t)pointer, _) is used in the tree...