Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8654635rwb; Thu, 24 Nov 2022 02:30:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf5BkNHHfNFMOA0E4XiDbwwNT/7B8JhAen6M1Tj4OkZrii5OufaGLo/15hMhTFo28W0O+ihY X-Received: by 2002:a17:906:6859:b0:7ae:4ed2:84f4 with SMTP id a25-20020a170906685900b007ae4ed284f4mr26720609ejs.429.1669285818455; Thu, 24 Nov 2022 02:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669285818; cv=none; d=google.com; s=arc-20160816; b=oBzf7aftXOgI2CxMvObYb5ph8kPmzMRspkyKXUreNpEuyD8FrF8VPk7jWZnJvk9Ku/ 1MlO/mf4Rx2LYa+9rpd5DrByLD6MRNuzy2Wt/AGE/2kK9jGz7eKDzTnSPnIzD55n8ovm xCS0uWzUp/J/ETTJu6dqsKE2tnSj8s8wv9958Qwnh+m8dVLItRVQZH2/BW39eBOopqke jjONswnVTOcqXCxPVuw6e48MVgpKZkwI7VAtvlPZLCebNmFAXc3tSOL0qaMMPNLoGB6J yMSDoGTWQ64ATpWyH+6ndDKVH2YqK9q1yTfM+AjnewsfWChjghHUAGmUi1uve0V87jPL VX9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=JpY3UV91PSJQHvgfwYlnFBFz1OoDDcdlR+QZ0N6B/hM=; b=jSOZ36Rg8ZtCE7SCbEU2hjbnj/WgKpo2k18A2Q3f3HQzjODOBeEcPKL8S3TupIleio y8oui80tFZxVG4jP1r1K91GzE5Tp7jIDLy949K893XSmxyf/oC64vq1IoDhNfw0liuog RHNVTrNHt/MAMNyikyWynXM6ZE6Geb44L4eZuPnJMLrM3PSlS5c/1zRYM4HJFsStwKco ynunYznQ/i4lZBlwpiDweCl4KwZ0OQSHTC1/tuD8pTE2I/EIJ4zuj7a8Yar647yjqbmD yYE/CU3S0i/cXO7yU+n/dTyqpYWrA1rxg9CjLg10mOjHms1Wb3F32AAA0lY+V+R+BTDJ S0sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ecx7bTcO; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a056402440200b004615c5728e8si160387eda.494.2022.11.24.02.29.57; Thu, 24 Nov 2022 02:30:18 -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=@chromium.org header.s=google header.b=Ecx7bTcO; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbiKXKCv (ORCPT + 87 others); Thu, 24 Nov 2022 05:02:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiKXKCq (ORCPT ); Thu, 24 Nov 2022 05:02:46 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BBA2B605 for ; Thu, 24 Nov 2022 02:02:42 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id e13so1854273edj.7 for ; Thu, 24 Nov 2022 02:02:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JpY3UV91PSJQHvgfwYlnFBFz1OoDDcdlR+QZ0N6B/hM=; b=Ecx7bTcOSXvqqMzZgKieAhLzr4QI6sOZ0G5WhPbqjpli2YJygDJoBB1T3p9uSK20ZA /srPeIHVf8B9M2Eppw/ZGUAp/7t4jj0FPpOeY54uTDstfB80eZd9mpt8+DarOrGJz2W/ 0kwgmSOb/mTNsWZEnWN+T9WSly8I00SpZyltg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JpY3UV91PSJQHvgfwYlnFBFz1OoDDcdlR+QZ0N6B/hM=; b=RJxJwgxdOq4/8POOXMdzsQQWp1wcEBwrV2oydMmw4ENan8QKTdp0MZ4lcFtIBmJl3i NtHQT5USNvDnV/SEp+33EwewI4CyQ9vKClBoJnRxRmt5mxFXUUoGNrrwScbibNQn9sFB AAm3+4tRP3uxZaYDgBLan4zmDlZdtchrNfiGy/Ye45mKCJY79UuhnJN+FDDfJ/aDHcyN DrSjWkm4zGUSIND1pmQ3J44ygq0S+euzXT/JmppMkKv+tIltWUGqGcJ5OztBsWHQO2Ta X1YUgqKr26oDBCXt3umT/1OXfeCr2Bp+zBq5CoRwoTmDrM9v5wM017ytc4NtsTmlfVSr hYdw== X-Gm-Message-State: ANoB5pm9awqiQU4w3ktFG2kJ5hxUVyYYCtSsqc+KfkeAL/iQH7dkJRN6 qJvHf83PK4KMuCrpsiO4pNiAGTCOTKYajw== X-Received: by 2002:a05:6402:2421:b0:461:524f:a8f4 with SMTP id t33-20020a056402242100b00461524fa8f4mr28270833eda.260.1669284160934; Thu, 24 Nov 2022 02:02:40 -0800 (PST) Received: from alco.roam.corp.google.com ([2620:0:1059:10:2a85:84f4:13a1:b293]) by smtp.gmail.com with ESMTPSA id i29-20020a50d75d000000b0046a44b2b5e6sm335548edj.32.2022.11.24.02.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 02:02:40 -0800 (PST) From: Ricardo Ribalda Date: Thu, 24 Nov 2022 11:02:18 +0100 Subject: [PATCH v2 1/2] earlycon: Replace simple_strtoul with kstrtouint MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20221123-serial-clk-v2-1-9c03ce8940d8@chromium.org> References: <20221123-serial-clk-v2-0-9c03ce8940d8@chromium.org> In-Reply-To: <20221123-serial-clk-v2-0-9c03ce8940d8@chromium.org> To: Greg Kroah-Hartman , Jiri Slaby , Jonathan Corbet Cc: Ricardo Ribalda , linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.11.0-dev-d93f8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1229; i=ribalda@chromium.org; h=from:subject:message-id; bh=BxupyuW9bNdLBDym2TmyvusXWxEqDYH/mW0kqKjxYbU=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjf0E3cz6hfTxPtG8dan4pVp0sHPvMZBTj4KHwf/E4 JrvN/HyJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY39BNwAKCRDRN9E+zzrEiDX9D/ 0TLkdFaNvc8KoF6EAzsYlDq3afSMn+zDYidrCvj3RXOx8empIqK7qgqXQFKeJR341BKHycrGMAHPr4 pl3cDfhOnKNZCm2M67PjNA/6heNjqNfnQVQf83fGx9FTgu4JX1QDaW7H7ESwOlAwrn5yZYCTIKyNY8 rBvWrVlzWp96Ad5s9mliNERtS1KSra9ejrhGSUDL75ngsJJcP3HgTpc8pkHxZT9poCT+pAR+R7cerG UvS+XP4XhTRkJMaN0QBIsnXR70HBBXss9VaJi3FzSJDfiKfHLTaAFFnjJuDLD/toqGhEUaCxFumX7J na2EYcIxuWjw9eGatEVm4+NVj2yxMRlRxAgbZn878IGtoj00gmQFYuR51lNqWhxCEa/KaedIq+7r3M I3momJlTlfvRnpFKDu872JUYuOWj2So5r3SQY4dO4RVJb7U4EREUmEEjML94oriCcP4F/8g8qD2Vbf MUWC95f5nu3H6leo/uaTaG7qme2CzlE9MXh2vecsnQeQAvSr+iMriRSh6txVBz/67EdohpG9+6NjVZ qJF+kHesFphNbQciwvCf1x0zlQJ6AKXCvLiPKwrATGsAEDORg3n5/Ad2s5cVe8gWLxvYqpmM9leoWy 94l/m+4+SjwWWzssZvf4ImOi2bzm+9YkOygrn4hkSzAi20clncDehiVaetkA== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Baud rate is declared as unsigned integer. Use the right function. Signed-off-by: Ricardo Ribalda diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index a5f380584cda..5b73da9487b1 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -120,7 +120,9 @@ static int __init parse_options(struct earlycon_device *device, char *options) } if (options) { - device->baud = simple_strtoul(options, NULL, 0); + if (kstrtouint(options, 0, &device->baud) < 0) + pr_warn("[%s] unsupported earlycon baud rate option\n", + options); length = min(strcspn(options, " ") + 1, (size_t)(sizeof(device->options))); strscpy(device->options, options, length); @@ -303,7 +305,9 @@ int __init of_setup_earlycon(const struct earlycon_id *match, port->uartclk = be32_to_cpu(*val); if (options) { - early_console_dev.baud = simple_strtoul(options, NULL, 0); + if (kstrtouint(options, 0, &early_console_dev.baud) < 0) + pr_warn("[%s] unsupported earlycon baud rate options\n", + options); strscpy(early_console_dev.options, options, sizeof(early_console_dev.options)); } -- b4 0.11.0-dev-d93f8