Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1221584lqm; Thu, 2 May 2024 08:25:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXuW0fMpeLOxphqL5bbA4n8odC7D9S/0ssyBNZnSXRsNYrAmnS+2fMC8Ks9FCPP2oZAm9Rf/X7fKaqNRnPVAQmZfdquoe7xU9BSa5cPGw== X-Google-Smtp-Source: AGHT+IHQK/7V1bDShXcKJiEPQ04e7HZIs4zVI/0UY+YxEpHgcp5oMvsQUq7WqIvu7Ducmv75XP/a X-Received: by 2002:a05:6a00:140f:b0:6ed:cd4c:cc1a with SMTP id l15-20020a056a00140f00b006edcd4ccc1amr2898065pfu.8.1714663540261; Thu, 02 May 2024 08:25:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714663540; cv=pass; d=google.com; s=arc-20160816; b=F7wo+BYDv/T45/+e8ILWEuUHOOoim+kOWhyaTULGV2NGgex7yX8Clp4cjieMnTtKle yzqlJeIQXgPkayYNMIhaTue/wvo8+mLWU+UeIfaAvFAk4veAglc3etDr92xWjJvWtZub ZD2KmbahfcCOc5k8jOXyL6cS8tV8Bj2ncZL8qXvM8LSksj+6je7kxlPVZZMsXxRV66T/ T0fqa0xQ7L7FunDPxDJmEwbQAIZYSZUph+rCggOKTxAU8YR8LWszcKHcBpd7tXsh/Fz6 R5iFjy82qXk3lL7DnYLPuRi1yHkeu7ZuC0tRMwYDLN2n2Vwdp4BCZw1XQf4VkE4uFbv6 8xMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cbY/VcBLbuHrSNodrdRFjHRQXR5diN61KT/KCDRPbos=; fh=fxNWTGqiar5MfenLPoutDMAtknTJH3swVUTrXJGS/Tk=; b=eemIFEG61lkKdyvNDN/eyTS9CFzIFpm225C4acAgw001QwdRSoHnfe5qsEjxFWeIeZ LGUAaKF7R2kgc4zk9U+Fe9X2ILhO60pFxUAbBlVelRFc2TZ8nDET0QVbsgBSaygqgdV2 PWo+7xNwsoIY5bQyAcL1u5vHb4rGgRgYfaBeJPT+GKUsfy0PqxMG6exlcg8hvLRNCB6g /GAFGGeDw22dCYV7/NnNb0eRsbgB/Kx3lCF1+fxs5nOpevawj+ypmeG6yM+Zc/mbIm9u IBWc50D318w1WdUAYcbcM2DXytxkwWNax4iIK79S9kl59PICCh+dEz45Pt13OdAKr/yu pLow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=EYtytLqM; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-166617-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b28-20020aa78edc000000b006f43c013f63si1030701pfr.309.2024.05.02.08.25.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166617-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=EYtytLqM; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-166617-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5BC29B249F8 for ; Thu, 2 May 2024 15:14:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B44C415AD81; Thu, 2 May 2024 15:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="EYtytLqM" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6831159583 for ; Thu, 2 May 2024 15:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714662856; cv=none; b=U25Pg8OP80k1HYsL6cEVBN7Owi2EEChVmVMfBSbqTA7EQc4dPly3wBbUBxGEKFraP/iNzSL1i2tqoVLyN32fckpkpMAEQ5NEkXn+0BbgSSYnp/iyURdcQImRYtQn+QMPYcCoh4ary6VWcv8XsNGVBGzMLhbMALQxnXh9K8U/uyU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714662856; c=relaxed/simple; bh=VDm/f33gMRZJn1IEH8M+iEGbrAW/USVPxcL7qJhNNmA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DQvyOheEmTYQcKNXdqOjHz0CjXgLfQT0s17FDCQu0QDK2ymqEbHSR3cJtTk2LZSRmhHBBwzGHwxRUWfB9UuUzuTCFdsOQ29fde4zgOf/TDjts4zlOQdTTD7A2RLvoD+5z2Q6RycGBI+75LRYPyh6QcGzeLjbsuWo5itDBEojabw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=EYtytLqM; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-41bab13ca81so62239025e9.1 for ; Thu, 02 May 2024 08:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1714662853; x=1715267653; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=cbY/VcBLbuHrSNodrdRFjHRQXR5diN61KT/KCDRPbos=; b=EYtytLqMVZ76YsJjd0Vx7l2qi2ja/HdQ6nR2lFOW5doo++NiLxvXvIPqcIK1cJACs6 THV2zuxjlG+z3JXCw2hE6oYKk+7Gc2nKiwAJMlZHnlZ3rndtiyk+aZjR/MdDf6ajIsXy UaysEipjVj73PznDKS6d46yOnUcUxT5fxjObkPTogyCtG72wTmXptUUJUjwWU/dEOuZ2 JOfR5qBGTEb1KnVK1QtDj170tzoma5NZ66hm96/BoBhYLC0mdWj+rOrVRBf80SVM2g/Y Cb5nQsw71X1yDFpYTYbee2XEWYC7HP3zAE5DHhL+lv6vWWA5uBzeIRRR3L7+M8zXyCFe ++VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714662853; x=1715267653; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cbY/VcBLbuHrSNodrdRFjHRQXR5diN61KT/KCDRPbos=; b=gk32lLr6+r9yvgBxFKeLh+88z5vktXqGwFzUOKvxBytI14WZ6A+hBuKMVxxXWtoD5d HxGlLsEBQacV/ujWFbWag/SJZseTdZC6xXl9NRBdPape5QB1ApbvAvGiW223xRddsx/N DHTRQTPc9LPOcHvrj85I/AU81HDhc+5w3G7OvCjj8DigG3Rfbw/UehSU4pMaqER23P6S +A3HPGSRm5BNYV2IqzsGg7U9UlQGgsKC5jARyCkGIbu7hEoK71fUTpnG6daaR1d4pmO3 7cvPHz4WaKBO6yojfJfXdukyVTBiKaRSCvMct/2n5ZSzkdeEs5i33A9ISTyHlVww8b65 G4yg== X-Forwarded-Encrypted: i=1; AJvYcCUA0FakDWNIDjHUB9+slf4by//cZGMghlEcq/2kkC6mpIETd1VNJCPD/d0pCtiXdCxN74NZgA8Km+1DseF1PgZRfHR7WPjUQwnL1R2c X-Gm-Message-State: AOJu0YyTq3oNhm9Gk1eYdxhsKOWdQb3Jrs4aBL4dD6EWtIeWa4j+YBo2 FbW2A0+8OuEnCIzj0YWLHWclJ19SR2fIm+xEc9Ls4MaivFENWBJtdCyG6yrlYmSbfBytvkDrWtk n X-Received: by 2002:a05:600c:450e:b0:41b:edf4:4071 with SMTP id t14-20020a05600c450e00b0041bedf44071mr23404wmo.35.1714662853248; Thu, 02 May 2024 08:14:13 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.50]) by smtp.gmail.com with ESMTPSA id z5-20020a05600c0a0500b0041bd85cd3f2sm2256509wmp.19.2024.05.02.08.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 08:14:13 -0700 (PDT) Date: Thu, 2 May 2024 17:14:11 +0200 From: Petr Mladek To: Christophe JAILLET Cc: Justin Stitt , Steven Rostedt , John Ogness , Sergey Senozhatsky , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] printk: cleanup deprecated uses of strncpy/strcpy Message-ID: References: <20240429-strncpy-kernel-printk-printk-c-v1-1-4da7926d7b69@google.com> <7cdc63b3-31cc-442c-8c2e-75adb2c76b52@wanadoo.fr> <289aa316-5067-446e-96d8-7b318fa367a9@wanadoo.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <289aa316-5067-446e-96d8-7b318fa367a9@wanadoo.fr> On Thu 2024-05-02 07:06:21, Christophe JAILLET wrote: > Le 02/05/2024 à 01:18, Justin Stitt a écrit : > > On Wed, May 1, 2024 at 2:39 PM Christophe JAILLET > > wrote: > > > Hi, > > > > > > Nit: The { } around each branch can now also be removed. > > > > There was one line before and there's one line now. > > In the block after the "else", yes, but now the block after the "if" is only > 1 line. (it was 2 before). > > So, {} should now be omitted on both branches. > > - if (str[0] >= '0' && str[0] <= '9') { > - strcpy(buf, "ttyS"); > - strncpy(buf + 4, str, sizeof(buf) - 5); > + if (isdigit(str[0])) { > + scnprintf(buf, sizeof(buf), "ttyS%s", str); > } else { > - strncpy(buf, str, sizeof(buf) - 1); > + strscpy(buf, str); > } > > This is a really minor nitpick. Not sure you need to repost if there is no > other comment. I could remove the brackets when pushing the patch. But feel free to send v2. I am going to push it the following week if nobody complains. Best Regards, Petr