From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 D645620C477 for ; Sun, 5 Apr 2026 16:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775405327; cv=none; b=kmxPBFYQJTEgCS0vEfiajdNYUDhztX3XomawV01Pq/qARReZk5QY31xHBZrLQsbz+AcLvkt0bSmoLmlPwOkyjXgqcdCGinX6f4VyyZS79utlhPp7ERwBdYXJ9LKNSk/GKWdDDmhb89eRrtytnhkKR5uN+OpY9uxxVTbk4cyJKnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775405327; c=relaxed/simple; bh=MZHxb/hI5Y8/FUzweWxD4pyGtX5aab/sfI67fFuZSYQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Tj3b6BME80kfEVFSrsb+N+zfu2ixyNr8wgK6Mn4Eu+2tk/zX9/J1uiwl8Nm7MAUDMhuHFwcaEQkMHQ9ny0Fax4VHtYG4cnc+WklDtxEcMrqtCyegEJEft4V8g7UD6nf4vUSpSKYL0Sa2o7QoE8ANTN2S1kQDW2sUKLK87SY6atg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VyPPaE5S; arc=none smtp.client-ip=209.85.208.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VyPPaE5S" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-38dd9194d8eso16796551fa.2 for ; Sun, 05 Apr 2026 09:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775405324; x=1776010124; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Fo/k++xBApY2IZkH8i0PfPpzPv/j3HI77IFEVLafkWU=; b=VyPPaE5SIxv2Lp+zuGeW8MasMM/flqeEra8U84F4d/PoxHPhcmi4e6j3N55x/CCEEo NeyGKcBfJAJhH3PUA1Dm45bd1KEUF8QWpXRu+LbaMMpYf8+ZWlCTrpQ4+SfktW2mxLl1 VH4gkMCZ9Uql3XybTLrZOIZ1gKsiO7wOuNElNAMRbajO6GnZn4H9O74OpYA9lW2C2y17 ZyZtx61EN71SZddgZuh/rOEijjOqMCKK8Up6VbwUr52TpzrE7EXnqQgm+q4r76FTB/lc ZzHyY87p3ZAEVWusXFLBqL4e5Eev6qULt4Kqc1D+vfM74E0pHY2mDqGwejKth+n/tnF2 ROpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775405324; x=1776010124; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Fo/k++xBApY2IZkH8i0PfPpzPv/j3HI77IFEVLafkWU=; b=HIOMIpxL7aJddANzEtGijpVjzRyeD+Lm4T7bL1cyCKv7Ny/ltRKyK6k/amrHN19v4B eW4+L+oGZ/LtRUNrLdfYznxaKNeBHlfauogukFOkJgxiCnSQGXB/3lln8nHZlFSRM04j Nmjz6J5MDFiYfRcroHfxAcQCQpELXJKCKC4Yark04lc0f4f63BWSw3GqzDKs8iTP6nn6 Qojbv56O3/3Gt/Xm/K/suCxMVij0e1kWedC+2KNLPqLK2gQKQyfXMQva7mymdqz4F7cH CU/6GW1oeHd3wCui07hCAYxBT2smcfrvPRiqLihjkmmfyGlmuWop6IlnqC7B2Xpswxg8 quOA== X-Forwarded-Encrypted: i=1; AJvYcCXgpLlh65VWRuzt0omQNO/JqBmXh67GQAuQPKLnJ9JLmem/VrX2guA6k1PlooMQhDAwgpyuKMcmpWaWFzw=@vger.kernel.org X-Gm-Message-State: AOJu0YwyzR8MylCmhomS8YlRPbCgLm8nUuEPpi62nAZFFChVzrQxrvF2 0kIq53jxr0kBrYSe2o+F83pOp0hU9qZ+w6oRFAUvmKRXMVouoIQck2cD X-Gm-Gg: AeBDiessJZ2TcMRaRY21r7aagBmXDRr1xcjbQrLtl8PGbUJoLz0MuwwGbJtt1j0KL4A 7pCF4RBhePmByWAKfT5+rKe+ykcSoR1Aa5Duh0IqYw4GIUeOPmuitXo8DgmUHQILy7oYVVa8S4J kVrarp9zMYt2QAIvPI3iCB+qYYBNCbjJsuitnsbZitSsWL6DGAq8/FvBepepg+31mbpgecJCN5G xunuqKEV4q4m0Bw7MAAfVGUHghBwG8Mg6epo6D9oAyh/EA7rYuO8u9zwxFA1ZGdqyAzNA/ODZBI KMsjhOsPu6TgN8uPyujyNNhvaJY8vGK9p7evWqWUPwiNYvE/braoTUjR9oGhB3nqNnMEiYBaBIP uXQv/3CHUpfX2X/4Lzqjw3cLAYPkkBja8R2drChT4MnmCU4ffcR4QcSBYQrHIhaGE0XD1f4aIcz UTZMsDrhCaYIHzg38r4YWuO6m/QMRblvW9r4rSkmwGklGv38z1ExyBeTrHu7ijwyQckIAROVWkU EXlKbcPpEcfwzlTtDjR X-Received: by 2002:a2e:b8cd:0:b0:383:18fb:fdf0 with SMTP id 38308e7fff4ca-38d91bfb439mr26385211fa.22.1775405323733; Sun, 05 Apr 2026 09:08:43 -0700 (PDT) Received: from ?IPV6:2a00:1fa0:4713:11ae:8695:b8b3:ca85:8248? ([2a00:1fa0:4713:11ae:8695:b8b3:ca85:8248]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-38cd212a927sm25612521fa.32.2026.04.05.09.08.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Apr 2026 09:08:43 -0700 (PDT) Message-ID: Date: Sun, 5 Apr 2026 19:08:40 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 7/8] MIPS: malta-init: bound default console command-line append To: Pengpeng Hou , Thomas Bogendoerfer , "Maciej W. Rozycki" Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260405102000.0-mips-cmdline-series-pengpeng@iscas.ac.cn> <20260405102007.7-mips-cmdline-pengpeng@iscas.ac.cn> Content-Language: en-US From: Sergey Shtylyov In-Reply-To: <20260405102007.7-mips-cmdline-pengpeng@iscas.ac.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/4/26 5:06 PM, Pengpeng Hou wrote: > console_config() appends a synthesized console= option to fw_getcmdline() > with unchecked strcat() when the firmware command line does not already > provide one. If the existing command line is near full, that append can > overflow the fixed command-line buffer. > > Switch the default console append to bounded concatenation. > > Signed-off-by: Pengpeng Hou > --- > arch/mips/mti-malta/malta-init.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c > index 82b0fd8576a2..fb782b1a3f6e 100644 > --- a/arch/mips/mti-malta/malta-init.c > +++ b/arch/mips/mti-malta/malta-init.c > @@ -78,13 +78,14 @@ static void __init console_config(void) > setup_earlycon(console_string); > } > > - if ((strstr(fw_getcmdline(), "console=")) == NULL) { > - sprintf(console_string, " console=ttyS0,%d%c%c%c", baud, > - parity, bits, flow); > - strcat(fw_getcmdline(), console_string); > - pr_info("Config serial console:%s\n", console_string); > + if ((strstr(fw_getcmdline(), "console=")) == NULL) { > + sprintf(console_string, " console=ttyS0,%d%c%c%c", baud, > + parity, bits, flow); I don't quit understand what changed in the above 3 lines... > + strlcat(fw_getcmdline(), console_string, > + COMMAND_LINE_SIZE); > + pr_info("Config serial console:%s\n", console_string); > + } > } > -} Huh? :-) > #endif MBR, Sergey