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 D4495C4167B for ; Wed, 29 Nov 2023 01:23:15 +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:Mime-Version:References:In-Reply-To: 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=PzbBnI/GvKlti89fSPlMCNKdIhMPGe8KFRgpHalayOg=; b=YOI/xWem++WHzK EEJl6WkLLd9miBNj+xvPkUhMipgNIg16+AD2MHxgIWOwyEyekFyIJBi9cMFemyYGjCli0W//oSN34 GnZH56BsR1TJKSdaeE9N9yFT2cQNhY240LR0upysKm/kn6Xb9Nh/iCOmdD6W5s2rByMMgIi+XK3Pw e9HH480DCEB+7DD9R53vl6n/LPes2k8fkqb2etz79m46EnDlB9W7N9KWLWSs8doWL2weARIxPDLV2 HZy9kDP+8NatDeBaabz00cbCRMq9lH2DFOr6XGkaFLGARWyjBWkdeMLODtqxxmopwVF4EyFuGF00g XCHAayz15VW/0FACEC2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r89Hp-006lWx-30; Wed, 29 Nov 2023 01:22:45 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r89Hm-006lWX-2n; Wed, 29 Nov 2023 01:22:44 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 7B95FB835E0; Wed, 29 Nov 2023 01:22:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67609C433C8; Wed, 29 Nov 2023 01:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1701220959; bh=FBEAIzoLgu9Zkuu5c9UADybKG5tCWoq0pA1ohTQwa20=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HTEloEWxitIAf4LrB+uGaCeVqy52QvkDsiW2ua5f4z/AKXmiI4hBsmwz7PT6WTZ1s Wxwfavqo2J72G1RZWH7aANFIO7lWJsNGHPpk1qGbaREMhcIco32+aA0fD6htjwWtLz m3FgVonjktFJ978Fuc/dQrQaVIQfLkN/ghI7VTIk= Date: Tue, 28 Nov 2023 17:22:38 -0800 From: Andrew Morton To: Haibo Li Cc: , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Matthias Brugger , AngeloGioacchino Del Regno , , , , , , kernel test robot Subject: Re: [PATCH] fix comparison of unsigned expression < 0 Message-Id: <20231128172238.f80ed8dd74ab2a13eba33091@linux-foundation.org> In-Reply-To: <20231128075532.110251-1-haibo.li@mediatek.com> References: <20231128075532.110251-1-haibo.li@mediatek.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231128_172243_423981_F43CD820 X-CRM114-Status: GOOD ( 13.20 ) 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, 28 Nov 2023 15:55:32 +0800 Haibo Li wrote: > Kernel test robot reported: > > ''' > mm/kasan/report.c:637 kasan_non_canonical_hook() warn: > unsigned 'addr' is never less than zero. > ''' > The KASAN_SHADOW_OFFSET is 0 on loongarch64. > > To fix it,check the KASAN_SHADOW_OFFSET before do comparison. > > --- a/mm/kasan/report.c > +++ b/mm/kasan/report.c > @@ -634,10 +634,10 @@ void kasan_non_canonical_hook(unsigned long addr) > { > unsigned long orig_addr; > const char *bug_type; > - > +#if KASAN_SHADOW_OFFSET > 0 > if (addr < KASAN_SHADOW_OFFSET) > return; > - > +#endif We'd rather not add ugly ifdefs for a simple test like this. If we replace "<" with "<=", does it fix? I suspect that's wrong. But really, some hardwired comparison with an absolute address seems lazy. If KASAN_SHADOW_OFFSET is variable on a per-architecture basis then the expression which checks the validity of an arbitrary address should also be per-architecture. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel