Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp317076lqh; Fri, 31 May 2024 02:09:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWd6s5/LWDv6xp9gfXS4q7GkF1dbG4NoMlG1iBMOPJvAg2twlUy9HBrzw9RG8jonmm5WKLME89sLq3FtU9uh5NUx0t+3i4arNn71k+SJQ== X-Google-Smtp-Source: AGHT+IFcUl8ODeas5bCuEVs3JxeECnvq6MfADTVzcY0Ym7aDDIwVWhy3chI3Mpb6Y2L7t0Oacms7 X-Received: by 2002:a19:f80a:0:b0:522:8352:ff29 with SMTP id 2adb3069b0e04-52b895a3e63mr969520e87.42.1717146555918; Fri, 31 May 2024 02:09:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717146555; cv=pass; d=google.com; s=arc-20160816; b=m/BrPalIcgOilTxy+V/2sOxe7w2GFYUpyVo6rfvwwGVwsZdyWsFp5KQiXqDuRRlXn5 YzDxLx/vrgD+vA4VB9YmJHXYE7NKphnYUwH1pZpvzjB0bPvGx84GVQo68F8GwjCzn4gN Gcc+8ZaJX9JDd9zBApoel2oNxhAFGQeV06V3ZUPiAtHzwkRS50Iubq6BboahgfTMxq5z m6+OSJ5T3+v95OP8kdmjSVeO3vr8DC1K0XPlXxY1VKMK8ZZF0f7OkCZ/fllsxwylkmI0 Crnmr3oDY3GENoKaC2l0I1xmEk/+QajwHBw9rduwpKIT6Gxah2cFEBOEsYxdGgkwJ1mJ 5tYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=TbbO+8+UH/N+8C8vOGXzOx4OMD+hvYGMWVttTRxqFI0=; fh=wreEAlD4oXBhtbS4LTffEihC1XjSRRayq6b1Wb355u8=; b=iBukHoiOfyFBRXJ7Bn49sCpwl3y9Ir6k9GUP/X+a1kaElqxVreIZx5zDWJ8xq5c0KD z1HpBcKFvvYoYAaiyXZe3D5KMOuFvyEVEggcgjwWMyMAdnKANz65ciw3hPt+PDlZQDQ3 DRWZodQhO3AnF5Jgivp/1RrU9GvnREJKjWYtpdPeivImADNI2vra8yU/TqLy/7lDntYi m1g1Cm/s5iOn9B6r3ncl8a3IQo3tX5H5CZSdZCPUwqegDGwjRVG3fc851Ptt529MFt+4 nvP+PS2HsZyYbZzzsuzJR67qILcn1SkwktgwzM2yTRrjlxmBmVrOxRZJ58IxAmXzK/Nk gBjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KHJdEKCc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196545-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a67eaf6519dsi72628866b.856.2024.05.31.02.09.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 02:09:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196545-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KHJdEKCc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-196545-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196545-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9C7431F23E48 for ; Fri, 31 May 2024 09:09:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F65C156C77; Fri, 31 May 2024 09:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KHJdEKCc" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 DD778158A37 for ; Fri, 31 May 2024 09:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717146321; cv=none; b=vEF/iikVts0yvj6+SrnCmlDkADXCCLZJnmjqfjBan59xECwTmRHduYAYT+XKiM/GbGN/XwykE46uhFjLzkxWDPX0updVpOR6WNkAOQcdhM6WdOVcRc+FLOxMmU5cPDHfcLnctHidqnK5L0oW1l9AwrmvLxmdX7HBa+kOouJgrVs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717146321; c=relaxed/simple; bh=OPnQwap98xBOvs4o2m86J9Ax9g2AZnbnCVbcpM6vIJ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e6GYP+0vAKk1oOB+U+LBNmnVwAXUNlxkPYyLptS/l7QERq5UzWqaUMV+jmFNNonuIiXrvubPUbOHDl6qQpIaHnLDQwaPOGmEgyivFk4JQvUX4isTjkGyi0AvnEhLCqDpH8MinLYRMhp2oeuSbyV/dyfsFMMdBNDjxPLejkWFjHY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KHJdEKCc; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717146320; x=1748682320; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OPnQwap98xBOvs4o2m86J9Ax9g2AZnbnCVbcpM6vIJ0=; b=KHJdEKCcxhbaRpUQzMrzH3v7FgUH0JfG+2XMRHaIZV6pXvB4aUF8Wd0S VscKmZ+l+SpdNgmFoH4tps2GFWJg6bJzmXDB0NAuQsx4UPK7dvhSgNUL+ INfNQEezEsNO1v0pGaQI3HI3IeaXd7xPH1t2w3mqHPIC93MOiZxPgZQsl aiSAwXlMwHydlrStFrrTC7woomztP+3VQ7C4pI2BkW6x+EZIVEV8GTvx1 MHoQsLSa+dbSg1H4QReu52BceHmiUGxHQNTqSBPJRIxUyN1+kwhr4Vkmh W3+Ch1Rr2qbRGokMRw7xzQRoGsOQHtJ+7kw4TuwlWkscm8uRhipztGLNL g==; X-CSE-ConnectionGUID: omXNirCJSE2JI8VYEyXeTg== X-CSE-MsgGUID: CJNFdUlUTMGh7vCPVBhdrg== X-IronPort-AV: E=McAfee;i="6600,9927,11088"; a="39074080" X-IronPort-AV: E=Sophos;i="6.08,203,1712646000"; d="scan'208";a="39074080" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 02:05:19 -0700 X-CSE-ConnectionGUID: hLsLMt6fRJiqvdVEDx9SHQ== X-CSE-MsgGUID: m+mfIFVoSXiBYvm6tFRHRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,203,1712646000"; d="scan'208";a="40543249" Received: from bergbenj-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.190]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 02:05:18 -0700 From: Jani Nikula To: linux-kernel@vger.kernel.org Cc: jani.nikula@intel.com, Andrew Morton , Greg KH Subject: [PATCH 3/4] kernel/panic: initialize taint_flags[] using a macro Date: Fri, 31 May 2024 12:04:56 +0300 Message-Id: <8a2498285d37953cfad9dce939ed3abef61051bd.1717146197.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Transfer-Encoding: 8bit Make it easier to extend struct taint_flags in follow-up. Cc: Andrew Morton Cc: Greg KH Signed-off-by: Jani Nikula --- kernel/panic.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index b7b2fb8b3625..8f7bb94ad7d8 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -472,32 +472,40 @@ void panic(const char *fmt, ...) EXPORT_SYMBOL(panic); +#define TAINT_FLAG(taint, _c_true, _c_false, _module) \ + [ TAINT_##taint ] = { \ + .c_true = _c_true, .c_false = _c_false, \ + .module = _module, \ + } + /* * TAINT_FORCED_RMMOD could be a per-module flag but the module * is being removed anyway. */ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { - [ TAINT_PROPRIETARY_MODULE ] = { 'P', 'G', true }, - [ TAINT_FORCED_MODULE ] = { 'F', ' ', true }, - [ TAINT_CPU_OUT_OF_SPEC ] = { 'S', ' ', false }, - [ TAINT_FORCED_RMMOD ] = { 'R', ' ', false }, - [ TAINT_MACHINE_CHECK ] = { 'M', ' ', false }, - [ TAINT_BAD_PAGE ] = { 'B', ' ', false }, - [ TAINT_USER ] = { 'U', ' ', false }, - [ TAINT_DIE ] = { 'D', ' ', false }, - [ TAINT_OVERRIDDEN_ACPI_TABLE ] = { 'A', ' ', false }, - [ TAINT_WARN ] = { 'W', ' ', false }, - [ TAINT_CRAP ] = { 'C', ' ', true }, - [ TAINT_FIRMWARE_WORKAROUND ] = { 'I', ' ', false }, - [ TAINT_OOT_MODULE ] = { 'O', ' ', true }, - [ TAINT_UNSIGNED_MODULE ] = { 'E', ' ', true }, - [ TAINT_SOFTLOCKUP ] = { 'L', ' ', false }, - [ TAINT_LIVEPATCH ] = { 'K', ' ', true }, - [ TAINT_AUX ] = { 'X', ' ', true }, - [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, - [ TAINT_TEST ] = { 'N', ' ', true }, + TAINT_FLAG(PROPRIETARY_MODULE, 'P', 'G', true), + TAINT_FLAG(FORCED_MODULE, 'F', ' ', true), + TAINT_FLAG(CPU_OUT_OF_SPEC, 'S', ' ', false), + TAINT_FLAG(FORCED_RMMOD, 'R', ' ', false), + TAINT_FLAG(MACHINE_CHECK, 'M', ' ', false), + TAINT_FLAG(BAD_PAGE, 'B', ' ', false), + TAINT_FLAG(USER, 'U', ' ', false), + TAINT_FLAG(DIE, 'D', ' ', false), + TAINT_FLAG(OVERRIDDEN_ACPI_TABLE, 'A', ' ', false), + TAINT_FLAG(WARN, 'W', ' ', false), + TAINT_FLAG(CRAP, 'C', ' ', true), + TAINT_FLAG(FIRMWARE_WORKAROUND, 'I', ' ', false), + TAINT_FLAG(OOT_MODULE, 'O', ' ', true), + TAINT_FLAG(UNSIGNED_MODULE, 'E', ' ', true), + TAINT_FLAG(SOFTLOCKUP, 'L', ' ', false), + TAINT_FLAG(LIVEPATCH, 'K', ' ', true), + TAINT_FLAG(AUX, 'X', ' ', true), + TAINT_FLAG(RANDSTRUCT, 'T', ' ', true), + TAINT_FLAG(TEST, 'N', ' ', true), }; +#undef TAINT_FLAG + static void print_tainted_seq(struct seq_buf *s) { int i; -- 2.39.2