From patchwork Mon Nov 14 11:43:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13042176 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7253C4332F for ; Mon, 14 Nov 2022 11:45:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 610CD6B0074; Mon, 14 Nov 2022 06:45:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BF946B0075; Mon, 14 Nov 2022 06:45:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 488456B0078; Mon, 14 Nov 2022 06:45:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3AD746B0074 for ; Mon, 14 Nov 2022 06:45:51 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EE4B840646 for ; Mon, 14 Nov 2022 11:45:50 +0000 (UTC) X-FDA: 80131868460.07.343860D Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf10.hostedemail.com (Postfix) with ESMTP id 79F0DC0004 for ; Mon, 14 Nov 2022 11:45:50 +0000 (UTC) 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 8B09BB80E78; 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668426350; a=rsa-sha256; cv=none; b=UmBaI43+wADf1nwxn8V7b8SfjRrYWVpyqxfrgGX0tCzXbBop5gdUslt9a9QkfQAw4x9wCN fEDSxuu7bWnEv8vNEJ7RXUE+R6OfrvnLhwLk+PBcTD5w51mimIJ+bseZtlEoXyOsp/Zdp9 v3/3X5G6nHRrxNgFPrq4IcPAQmXUI50= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EFbgopP7; spf=pass (imf10.hostedemail.com: domain of jirislaby@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=jirislaby@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668426350; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WKn9laZEOJi3RLi6Cjh54rnSbYfEE4oIQi1+zqu/7Pw=; b=NtSH1coMrT33kn5lkTG8o4o4nz8hXzRcltO/CGQtGxaPsVd26okc+czfUBmnF6oT677cjt 2x35NM9GAULOcs7pCtsuZ2gIEPtErw+lvjyZcjSsbgb78GzvWCszm/FR88R/AiSxyY2AAh 1b5cacxuvXUadGF73naYiJDZwSWWDxo= X-Rspam-User: X-Stat-Signature: ohg1w1bu4j53yj1qgem67oe99fo5c5d1 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 79F0DC0004 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EFbgopP7; spf=pass (imf10.hostedemail.com: domain of jirislaby@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=jirislaby@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1668426350-889250 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Reviewed-by: Andrey Konovalov --- 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; } }