From patchwork Mon Nov 20 00:04:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuran Pereira X-Patchwork-Id: 13460709 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=hotmail.com header.i=@hotmail.com header.b="kn7lFaMe" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2083.outbound.protection.outlook.com [40.92.91.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078FD13A; Sun, 19 Nov 2023 16:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O2j4sGzh+nO1T1UQioDthM/CMv8DXwIHdyaFfRCKVVYm+ZPkChUsfRxWPq/LA6etyubj4FX0bWqsdvvQOSHI3Mu0KhRO3UteZb3Vgc8j0hIBnRmHg/T6/o70vUpCSJHDz0IReQ2vyFYzzXBRh4kxqaWv7dG3rJgeqkHRwoUsMgSm/Q+EikQJTeb0CgZ9yuEwgIftvytg/Plo2R3R22LasXVbLj58N9AHQIRZ2wp9IR0WHVKPy41MOdtrTQjm3KfMgRUdBl8SvnxT/F5cVlKJYS+ke4Fnw65zYM+uUNA9HZgsI84JcBu/hu2XrHnLOACtvnLL0lgKEG5XYTtwewzn9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3g11QrkDSBIAJbZu88aqK0HXtr+sMeOnahGGAOP7xDk=; b=ARgxzccGXpo7/wu7I/0L5nATFM77j5SPYHxfvtDiVP5N61ULuCeKv2MNeOefnyNs4dKOWyR5xFeMyo7OSgl+wMMazIbtWzlN6G/2blCZnOnWx3mNflRIpwSurAx7qkLlTfUGYMymDxAOXLw+LN/5081vNWapORYgNAfSHqQwIHxZ+ZcNswtK/1ES1303T3BKtOwqRDr5ai1B/fmXNCMKloQFRQ+m2LIaDVn7XsvAaOPB8MKE4lszs07eKLbgAD+owySm98w2uyZPxMMJe5WOTusSsSugtRX1+S2W+uFtDBiB9AWmJJ16h+TulTaBN5lJFGXVf+TBSNN948fPq8JwgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3g11QrkDSBIAJbZu88aqK0HXtr+sMeOnahGGAOP7xDk=; b=kn7lFaMebzRdScMCXidmt+WtPpK+5x43aeOPiz1cADSH8RYPP3kB3kSsCdIdc3FgjZwwRZXiXA4CXWYMIH6JKxsC1xd0Gm5ThlB9ZxU8eeAgBCrfNR0e9Ls0a4YGDuF+UlcvehGgJZiGpBL44QzDMyfiUlL17vpm6UW2zyhncrc4I1tDtF/Bg2SHTk7Ro+SlPjYjiSTowCicHAoFvVRNDAUkX0OJngGdf9L3+6YkgL1vKc4Q6u/TtoPk7uy/iJMlMV42N7YDOlpazwcInjU6/5wCRxQpF5FCIOnwSbdVeW07XyPahf/0psegeodUE7zuYiHwMo17GHa6jwpeP+XChA== Received: from GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:83::20) by AS8PR10MB6173.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:54a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.27; Mon, 20 Nov 2023 00:04:27 +0000 Received: from GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM ([fe80::6c45:bfdf:a384:5450]) by GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM ([fe80::6c45:bfdf:a384:5450%7]) with mapi id 15.20.7002.026; Mon, 20 Nov 2023 00:04:26 +0000 From: Yuran Pereira To: kgdb-bugreport@lists.sourceforge.net, linux-trace-kernel@vger.kernel.org Cc: Yuran Pereira , jason.wessel@windriver.com, daniel.thompson@linaro.org, dianders@chromium.org, rostedt@goodmis.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org Subject: [PATCH 0/2] Replace the use of simple_strtol/ul functions with kstrto Date: Mon, 20 Nov 2023 05:34:05 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 X-TMN: [NYhL6MtTjM8EsixAEDVcXCibrIcaG/Fh] X-ClientProxiedBy: JNAP275CA0033.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:4d::14) To GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:83::20) X-Microsoft-Original-Message-ID: <20231120000405.360208-1-yuran.pereira@hotmail.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR10MB6563:EE_|AS8PR10MB6173:EE_ X-MS-Office365-Filtering-Correlation-Id: 99f0dabb-2e72-46fd-eb9d-08dbe95c4260 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PjymhnWGZWRlgVJEUXTbQiRQb7jkVGxpC0Fhok4qonWrHOqHyCa7LyD8DrMdZ89/PxpEIKlJC4KZSvGmKGMnDz/nEkXe33LXxcltqlD3eWLdFhUljAgLo6sj/l833t70XDrLEGlBg+BtgHqzxYqSVZlWPRpHdxKRo0fEClwJSwUiHqWILjT3JZhKS4NVLvZQITEFvxfa476isSBwqI+dYIS4+i2OBjW2earpU9kzTS5IU3zjIKkDUGRwX0CXhRhcAC3EBRf+lm1IJCoFi/J7j9lowD4pltsGV9gPfH04hzChlnmDKhEdobW6vE5KbdNomnR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BADRlKmlz8QjqnOoa6gYGUGJakbNC71KGMo1S1LTwAfsapewdR8TKR6ql1p3b3aX0005dOP9cMTvj1v8ixFaV6R2VEnZTzzx5uj96n06QzEcPKk3ayenoBsUQtzZwbPG3W856EvB38nN+5H+9sOf0w1bumrF7yzDBvt7fo8NYC0cFeMzNo3Or5BcHZD/xif1KNAWTy7eZPQu4/CmoD6SQMygToNONw/eUA/orlV9kvZumxx6y5H0m3eayiXBl2IX0v4rTEy/WdZF3sVd8tUj7u2XYzhtpDio4tkSSdfpM4WfrlhVivZ2H99biBL8OPoTvWk+ePCBJ1frjJkPwKqcrbsWEsscMi2S3Tr4pFA2GBvgZQNjW5psXkLtQBh1soc2fCpXGgwr6YyG041Ff9Jc4nQNB8LCBbMwsbWddvmjupGG1dg21iKK+B45lG23CAM+GkFzeNg8AVa/yLWVWOyXAqdCJgVdBB9pB20JFuuESsMP6HeqpQC1eDv+NiCWayfiOF1SuJ1yvQWG2J3gc+mnmPNXrLx1ouKrKJXR8nZRexM9EK5Q9ug= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6b909.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 99f0dabb-2e72-46fd-eb9d-08dbe95c4260 X-MS-Exchange-CrossTenant-AuthSource: GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2023 00:04:26.9414 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB6173 The simple_str* family of functions perform no error checking in scenarios where the input value overflows the intended output variable. This results in these function successfully returning even when the output does not match the input string. Or as it was mentioned [1], "...simple_strtol(), simple_strtoll(), simple_strtoul(), and simple_strtoull() functions explicitly ignore overflows, which may lead to unexpected results in callers." Hence, the use of those functions is discouraged. This patch series replaces uses of the simple_strto* series of function with the safer kstrto* alternatives. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull Yuran Pereira (2): kdb: Replace the use of simple_strto with safer kstrto in kdb_main trace: kdb: Replace simple_strtoul with kstrtoul in kdb_ftdump kernel/debug/kdb/kdb_main.c | 70 +++++++++++-------------------------- kernel/trace/trace_kdb.c | 14 ++++---- 2 files changed, 27 insertions(+), 57 deletions(-)