Message ID | 20240628090517.17994-10-laoar.shao@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42BA3C2BBCA for <linux-mm@archiver.kernel.org>; Fri, 28 Jun 2024 09:06:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C89436B0096; Fri, 28 Jun 2024 05:06:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C10706B00AD; Fri, 28 Jun 2024 05:06:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8B746B00AE; Fri, 28 Jun 2024 05:06:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8AF706B0096 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 05:06:32 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3F56F1C2B73 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 09:06:32 +0000 (UTC) X-FDA: 82279716624.28.94BA17C Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf03.hostedemail.com (Postfix) with ESMTP id 6BCFC2000E for <linux-mm@kvack.org>; Fri, 28 Jun 2024 09:06:30 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=S28Rg9Kf; spf=pass (imf03.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719565582; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YS5JkKLpH7rBBlezu3RsuBopuhXkHEJwrCmaySM0BwQ=; b=nlIsjcAaX6HZCZRY3Qk00JX/CHaQ9tqgdtDgylxwF4OVNKs8BAs4ycQmAKpWATVHwZEzGu zlMpBn55AdkmzaavctmZsOHAf40j/oaw8J8aCHUNqb1a8RLlASOrhVv/O+HJEN05SQnyTI BHz715c7jR6Hvlebsi0wUwizBO/rmik= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=S28Rg9Kf; spf=pass (imf03.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719565582; a=rsa-sha256; cv=none; b=XI1rTQ7haTmS3Lxz8oKV0vt/s2oyMEqr0AW4MZj6eEz3e5gcHtRR3zvvM16G3FucliuRQd pL3EFIXsiQk0E9y7MSit1bO75unBGcdI7kaNGahug7YBXewZPj6zPwvctd5JMan5fP8JT/ oe+0zlRAfL2pRmY1XEnMaJ6q15ogvTE= Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-718354c17e4so261579a12.1 for <linux-mm@kvack.org>; Fri, 28 Jun 2024 02:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719565589; x=1720170389; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YS5JkKLpH7rBBlezu3RsuBopuhXkHEJwrCmaySM0BwQ=; b=S28Rg9Kfi8hVi3mSFd5TUOyftUHyd8o9BlU1aJJ6PTN01Sg4eR0BixtNl1RolnDz2q EiMhCG+x/qcioIWHUHH4n5OTNLizDLH42zlfPzhrn6VYm4cVkOYfvbNyjz7OIs/4BPAz U7qLWn090Sz9Q3uBEMHAq9s5jenIurDpCKN7eN6EOSutVaxXJb3drRXqQFqb3Ti4mT2j KQW8IJBFmIAhA0JN/TOH8UWBWrDwxOG6CCk29O4c1/MQJQUQHavobaxeTeAdojqfvaq/ kt+bCqLcKVKsouoIAlm8ZB8A4/YN9DKTUivX6EuOnWnAL1k31z2pyHK/t0NqnZlS9rwF Hteg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719565589; x=1720170389; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YS5JkKLpH7rBBlezu3RsuBopuhXkHEJwrCmaySM0BwQ=; b=XHRPY1732nHGL5cln0xg9HceCAUiAvLg4vqCf8jyu2E60XskkUVyIUvhEUIO5+eAhS +D0jl4pNK3wmJvu9nIf6l3U300uIRFg0F6f37KtqOH1Pe3CroA9SSdHoZ1VDQIcxW1A/ 4yqYNLS+LlR98JoUtawrNRju58ah+caKDR8m7Qd5G4Ep42oymBIgt0qMNhE/Cx91s7nD wXJZ2ucEdF5VUfNJT/0S6OE8bbb0TE0frySihlD1IkIqwGR3cjjsKzT1VT1cw2Y4y/Te +JnhuxsdqLyD3c+9XPbJ7WYWNXVnZX1NCYHQj+3YPvOp4zFWYTfW4d5SbxwOGEVELeXo Z+aA== X-Forwarded-Encrypted: i=1; AJvYcCWWInEOPg7meJJwEI9iXQXt6YuJTrp3Yb+H/maE0PdMLaODUbubQ9XyqXNd+FyN4p3/Hifnx6xVfYEQ+U8TW3f+23Q= X-Gm-Message-State: AOJu0Yzb5CNA6Yb43XlUn5nLzVV0ETkoIrpPVIYYa4I/NsXzofklvQjz KviKMJSiZ/Z8/6lAyo92tC9Ta1c7HW7VSnw8wjHuS0RaGasffr5w X-Google-Smtp-Source: AGHT+IGOKlpBVO+d+BglzrA1U38WRrINDjYkTk3SrZCioD4n2rLQ44T0idrxtclcQs0Zl0I35xoQFQ== X-Received: by 2002:a05:6a20:b391:b0:1bd:2200:23f5 with SMTP id adf61e73a8af0-1bd2200244amr8943793637.39.1719565589157; Fri, 28 Jun 2024 02:06:29 -0700 (PDT) Received: from localhost.localdomain ([39.144.106.153]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac10e3a1dsm10473085ad.68.2024.06.28.02.06.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2024 02:06:28 -0700 (PDT) From: Yafang Shao <laoar.shao@gmail.com> To: torvalds@linux-foundation.org, laoar.shao@gmail.com Cc: akpm@linux-foundation.org, alexei.starovoitov@gmail.com, audit@vger.kernel.org, bpf@vger.kernel.org, catalin.marinas@arm.com, dri-devel@lists.freedesktop.org, ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, penguin-kernel@i-love.sakura.ne.jp, rostedt@goodmis.org, selinux@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, David Ahern <dsahern@kernel.org>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Subject: [PATCH v4 10/11] net: Replace strcpy() with __get_task_comm() Date: Fri, 28 Jun 2024 17:05:16 +0800 Message-Id: <20240628090517.17994-10-laoar.shao@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20240628090517.17994-1-laoar.shao@gmail.com> References: <20240628085750.17367-1-laoar.shao@gmail.com> <20240628090517.17994-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam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08g+Q00Kz96ZWC5MEJIY6rMTO5pE8zXM+pCRi6gfP3tDsPdlMSAfDmMb81of/gFjrT2icOFWwtvbQmbiqv54PU5EYjc+ruc30e6xCtEEl8kHIkpZVFeipEFIinG+FcbnTBtZtFz1DiGbPxUwNQRbqgz1Q/DHZtS5Z11wS/kQJiEz57VpPTWK6OoFFXxc2WaOM4gAd8lMhOGorx7zYm1/5y1/jDUwJMTg6A0wFpNdGTTJ+c5RvqveSKbqrqOQBo0hIrkvj8wY9vSx/k5vkjcIYZ4KETzf7bdsP6f20BN9InIFzZnH4NqpRLTACUzC5zQl6Nl+/i73fVqTxQfW10LufUeQZRHRJEKO7negSdDLgErbqwUXQCXCHQnKyvN84EItdK/XBAiOdATzQV/EljL4+GT7SV+R7nDxYBMrZ2bLGVEf7Y2AAoVXMTSAecTCSbZixn2oMKS62tq9yEIuIA5AjzTlqBbLc10ZOMBBKwyEMH5GRZpe4Q+I2XtOWNHdCNCKPZpG9bz/APf0FYANV0T4zkBIuH1/0ikWcRqvHa2reNArEAmdMdRN+WgnyrMNdpmx+vLv2imynHAZE1hxhmi7sYbazV4ZLmf8ZzCESmRLjObm7Q3Yen1c1g/a2O/yIv2/yQz6rIYfpOUV7i/ZuxCGdh8J X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Improve the copy of task comm
|
expand
|
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 254b192c5705..10d8e8c6ca02 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1942,7 +1942,7 @@ static void ndisc_warn_deprecated_sysctl(const struct ctl_table *ctl, static char warncomm[TASK_COMM_LEN]; static int warned; if (strcmp(warncomm, current->comm) && warned < 5) { - strcpy(warncomm, current->comm); + __get_task_comm(warncomm, TASK_COMM_LEN, current); pr_warn("process `%s' is using deprecated sysctl (%s) net.ipv6.neigh.%s.%s - use net.ipv6.neigh.%s.%s_ms instead\n", warncomm, func, dev_name, ctl->procname,
To prevent errors from occurring when the src string is longer than the dst string in strcpy(), we should use __get_task_comm() instead. This approach also facilitates future extensions to the task comm. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: David Ahern <dsahern@kernel.org> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> --- net/ipv6/ndisc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)