Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5380043rwb; Mon, 14 Nov 2022 03:59:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XcAFmzOyZp+V5r9H9NilhlbgTXtKdtOyju4/yDFEuOrqCdS+GFu5mUFJfkPxerNDGBLBD X-Received: by 2002:a17:90b:124a:b0:212:fa9a:3c47 with SMTP id gx10-20020a17090b124a00b00212fa9a3c47mr13260483pjb.41.1668427176671; Mon, 14 Nov 2022 03:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668427176; cv=none; d=google.com; s=arc-20160816; b=NlUXTwF8YsjhRITVuIas7KuLqPrNAS5VvfrdjrjE+ZOO6PRZ+5EGbPBWGaqchsswZW lgVadtjA8RLByHVa+4qnoAL4FweZ3gZeJoU6lu0xxP8WIY8tuT3Tbe72m4nPgkCiXSn7 QtFYWI3NGQn/JuQqNF00FxkwSMxPABLphQyBANVWpRDqN9a9tD3DMJZcvINROo6ykVcS 5Prl7o3V4vNs+w0gwi5AOqSbIz1SyUoUv69HpPtC+ri53WKnd7Bkp5jHlEZuHM0nrRkV 6BIze+BG5nKprNQv4KIiaF07D+IHpKMhUGuhh7k6yI8kxy3VwWg4zmzbRELfkY96dM9Q WRzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WKn9laZEOJi3RLi6Cjh54rnSbYfEE4oIQi1+zqu/7Pw=; b=BGdO+mlXhwdXLxwoLYQ4iPXb3QbP3+BdD5uTACVbPB+WkggfE2u9TKbDm0IG1aYgUb cDrUeQslrCWvFS/7KsnVNdpJW+CW2hHuUGcFLNEwxdQUtkfl6+zac0Cs7ydJq68g9IV1 Di95KHdo/KGEgcfBOsHWq7eesySPI2IX9L+ArrcL0fbz5xbHc21FICq5enAOzZVrCHN7 1BPNY81gk529ZUki6oZpKEBenwi8D6RZ3iSroTFd6k1JKkgMLXVPURMoMBLJCjIwojBZ +Cxcu/E1gDRHWepBVfadQpobJJ1bclHpVqthJ3rxuslWIop0QXGIadNOkmeMnwMjOLSy dYYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EFbgopP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a634a53000000b00473e4d2c9e4si9382258pgl.218.2022.11.14.03.59.25; Mon, 14 Nov 2022 03:59:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EFbgopP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236936AbiKNLtS (ORCPT + 88 others); Mon, 14 Nov 2022 06:49:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236807AbiKNLsp (ORCPT ); Mon, 14 Nov 2022 06:48:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FE926ACF for ; Mon, 14 Nov 2022 03:45:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85743B80E73 for ; Mon, 14 Nov 2022 11:45:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E18D3C433B5; Mon, 14 Nov 2022 11:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426347; bh=Vp8sXRjsUE/N3VsCm0HTjAxgxp+yKdf3km9PrguLdDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFbgopP7Xnz3OCxeyZ9dcO7w77PdM+IjWJR+aVFwRb07CIksjaoVGfWRstf783N3H E9KmA6woJ2FGqfK90S6TJFAAg5qqUMfIZnpNnD41beNsjEwz7rSxXUrO/OrMHRPSV3 kDGkTCXO58rfI0ilFhyev9a6eZAWQ4x6BDFE2vqHEpHf0eHS/AIvBpS/g2iCLWeQCw tuPzy3sFNcoiPdUxzbGfFS2cjgRdxlor4gHE27/K7pGeaQwOwKcjJnL6WF/8Y/rjRI BS2gkGyi1GVd1B+Xzolmhmm9kcReS83I2v/sHxf4/uIXfQZgFX5WQhRWeZYl4WEm3q I0gUgpxAvcQJw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Martin Liska , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , kasan-dev@googlegroups.com, linux-mm@kvack.org, Jiri Slaby Subject: [PATCH 45/46] kasan, lto: remove extra BUILD_BUG() in memory_is_poisoned Date: Mon, 14 Nov 2022 12:43:43 +0100 Message-Id: <20221114114344.18650-46-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Liska The function memory_is_poisoned() can handle any size which can be propagated by LTO later on. So we can end up with a constant that is not handled in the switch. Thus just break and call memory_is_poisoned_n() which handles arbitrary size to avoid build errors with gcc LTO. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Vincenzo Frascino Cc: Andrew Morton Cc: kasan-dev@googlegroups.com Cc: linux-mm@kvack.org Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- mm/kasan/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c index d8b5590f9484..d261f83c6687 100644 --- a/mm/kasan/generic.c +++ b/mm/kasan/generic.c @@ -152,7 +152,7 @@ static __always_inline bool memory_is_poisoned(unsigned long addr, size_t size) case 16: return memory_is_poisoned_16(addr); default: - BUILD_BUG(); + break; } } -- 2.38.1