From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DCD66ECAAD1 for ; Wed, 31 Aug 2022 12:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EBGb+dMYx2e2ilrmuNWPjwgaHvMmICqa1SXjj1v5z2U=; b=UQ/vyv/4Nsx9rx yElanBVzIrb+hU9PCuTiPEntdjWEaK/ZABmoGFs14T9vj/p5cf0jTcxO16HOvG5j/cPkP53TESaRD 9LuVTR9bTrVGs2iHmtFpI4DxAhEaAPYE11Iwt1Yiz9SsmqZBqIPYiqoBu+EHTNvot3JlgkEM0brft bMG7ESsCKhF0O8ZqhQWbdi+giK8VWqBXwsTY/aRukrYCdfpvMQA82LN3eznTraCKPDPOwiHxKj+e4 7pbdsUr4l1MIo0JeO/7OpeDlXrQUzwKlFOZZ+/9aW9dmk/6Ae81hHGNaJWYz/9VyyCWfHfRmGovDs mJnMCyZv2+hDZqckYJjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTN9z-0068BP-9z; Wed, 31 Aug 2022 12:49:35 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTN9w-0068AL-M6 for linux-arm-kernel@lists.infradead.org; Wed, 31 Aug 2022 12:49:34 +0000 Received: from maud (unknown [IPv6:2601:18d:8700:1ffa:ccf1:c9dd:4b35:443]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alyssa) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0948D66015AB; Wed, 31 Aug 2022 13:49:22 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1661950167; bh=udSIZcRQcz0xs4pptDqsvC6JIR0/xiMXACrZHVRDjj8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WVIS4Tj7khhOhQPDdSLYQKH2tSYXVhTnh+dDROU+88k4Dgw9zl/pnNG1P3KH3IgXm u8ERa4TxvnXBk85RoznWkOjg64UjlNiLfGRIM8k7T8W+HPUECCGDh9LqiM4hCbaprv 7UGgvOM9Qg7TmT8FOzw2joPfp9TDZBhoiPw/YBnpOzceI/G3iW4Gh+J7gMn4xUryBD Qg9tSc0WeCy+nxGQ6+wcEv0jnJWNaGd9Qw10yysxGtGM3SaARMep4ksW1xFWAG4B1H Dvv0R7d40IDpcOEx3r8Z/QsRCj83ZtENXIg4Dh2UYtZHgX97tLN0URPUnPckPzykjk JD3lfz9bIH/jA== Date: Wed, 31 Aug 2022 08:49:16 -0400 From: Alyssa Rosenzweig To: Robin Murphy Cc: robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] drm/panfrost: Update io-pgtable API Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220831_054932_971577_B0F44490 X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 23, 2022 at 11:42:33AM +0100, Robin Murphy wrote: > On 2022-08-23 03:51, Alyssa Rosenzweig wrote: > > > -static size_t get_pgsize(u64 addr, size_t size) > > > +static size_t get_pgsize(u64 addr, size_t size, size_t *count) > > > { > > > - if (addr & (SZ_2M - 1) || size < SZ_2M) > > > - return SZ_4K; > > > + size_t blk_offset = -addr % SZ_2M; > > > > addr is unsigned. if this is correct, it's magic. > > Eh, it's just well-defined unsigned integer overflow. Take "SZ_2M - (addr % > SZ_2M)", realise the first term can be anything that's zero modulo SZ_2M, > including zero, then also that the operations can be done in either order to > give the same result, and there you go. Shrug. It still seems voodoo to me but if this is normal kernel style I'm not going to complain, Acked-by for the patch regardless. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel