Message ID | 20240613023044.45873-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 7D75FC27C53 for <linux-mm@archiver.kernel.org>; Thu, 13 Jun 2024 02:32:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E3416B00AC; Wed, 12 Jun 2024 22:32:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BA386B00AD; Wed, 12 Jun 2024 22:32:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0207F6B00AF; Wed, 12 Jun 2024 22:32:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DA6496B00AC for <linux-mm@kvack.org>; Wed, 12 Jun 2024 22:32:18 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8B2EB40281 for <linux-mm@kvack.org>; Thu, 13 Jun 2024 02:32:18 +0000 (UTC) X-FDA: 82224291156.21.EB4848B Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf04.hostedemail.com (Postfix) with ESMTP id BEB4D40002 for <linux-mm@kvack.org>; Thu, 13 Jun 2024 02:32:16 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iNYvOdXv; spf=pass (imf04.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.172 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=1718245936; 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=wLV4tdtvKwjUMxvLd3MjEerWvvi0S3KYqORy/5kgs/I=; b=zYNefCzM8IzG6jrCKD74Sb+3ZnMl/55hMooTl/2Apn1XVQH/pW3rkHEs67QMc7RFUOS5Z8 B7z91y0BzaEe4Bt7VRF+if8Nw21hIQTTbbH0RjFclsvNlSOZ6WRr5tiOqiMSxqrn/19LUU vz0dbP+UKojQ0NOHrwyG3pk6K9kELBo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=iNYvOdXv; spf=pass (imf04.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.172 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=1718245936; a=rsa-sha256; cv=none; b=PN67tGB9G09Fr+P97v5vwQYRj/sn9iZUDx3I8ib1wWaG0Lhl0Rs2ea1hm134nIvzWsHgAT /oBXMEXTB5dbSSLLFhoKAuPgkPHmnnKVQ7uAykXbMCTFAY+BY1c/pkIm4dvTyep/j6uawN GTOfedPD/t3KrRLWLtRxKu6TyT+hbbA= Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1f6559668e1so4960665ad.3 for <linux-mm@kvack.org>; Wed, 12 Jun 2024 19:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718245935; x=1718850735; 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=wLV4tdtvKwjUMxvLd3MjEerWvvi0S3KYqORy/5kgs/I=; b=iNYvOdXvEtg0CpOK/9HQpPK+g3oCSAJk02Oa0T5nhMvhfpqgK5nGGynU6D7281ywZg BjhYzSBiyFFVKJviNidS+TiAzDcTziB5TXPtnwZgWIdMNTTjJ/AajTwJyUBb3lunHK4c 4RnYdHIbjSnz9UdXKW9HLVrONok8rlat+6cmZNO5kQrhmOQO7I0OwZx5KGagTtaJ4hWe 4KmwjgJbJun2Xnu74iMmu5g2Hixn4DdUAGYFEVEG1y/76+x5V7YgrTk7bSwf25E2+JWF XvfnKg3REtcoRqk/N9cUMM4iqXAzaWHw7iVMRA8VGeML6XjqEgXMczrIxSq0ETnwU3d7 iW6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718245935; x=1718850735; 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=wLV4tdtvKwjUMxvLd3MjEerWvvi0S3KYqORy/5kgs/I=; b=aMp+ApCcEQGPr2lieQKx4MbdB9zRhrDZmoPNeHpWkU7kJc9LdyAN5URLeIVRKrcmY+ xp+W0sShQ3hHqs7QRHM1vgGqPnvKxFOEIegqx6CPg/bogj+lRtO19Fc5sRRr4faQyugo igr6HFQkR8Vg02btiTVnRxG5ExzJF2HFkIVczXi62HxKWaGFtGB5U+Zr4G3J86WXa2kz Delp3pv42NBsjSBSd4u1t8Mz9Mr5RbLdptwFO423rf4EbE/pL1mn0y+8o2dqerv39TJs 5jS9hPYmEnaDCuuRxPrJpo7FOyCt2Orxd7ZfMYh1eXGRvReK23cQYb+53haI4xE2in7F M0iw== X-Forwarded-Encrypted: i=1; AJvYcCWe7Mgd9gjQTJpdcBMuN9yFj6HbiNhjWLBCItnRZeCoV9CiV+3TTPBWWXdRxuSN2Tm4UdyJD0dINjdEi4jMv9dLVMQ= X-Gm-Message-State: AOJu0YxdoBuxzKue+MEPYwnmTYYHVDoz+wnRe6xE0qW7HXQXvght1Ips j7dDOPVlFJ1UhGkyxuOYVNcpPb/o9bAMd77rtWB8CEYaB10G++X6 X-Google-Smtp-Source: AGHT+IHU8nljO/XpjX7VaEB7PAOC5fyOplOexRJH9EcW/3foBQqPSTf9j2DyRFgOTFj3wqtthRwoDg== X-Received: by 2002:a17:902:d4cb:b0:1f7:3763:5ffb with SMTP id d9443c01a7336-1f83b74d134mr37873815ad.59.1718245935611; Wed, 12 Jun 2024 19:32:15 -0700 (PDT) Received: from localhost.localdomain ([39.144.105.92]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855f4d159sm1755695ad.289.2024.06.12.19.32.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jun 2024 19:32:15 -0700 (PDT) From: Yafang Shao <laoar.shao@gmail.com> To: torvalds@linux-foundation.org Cc: ebiederm@xmission.com, alexei.starovoitov@gmail.com, rostedt@goodmis.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, audit@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, bpf@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Yafang Shao <laoar.shao@gmail.com>, "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 v2 09/10] net: Replace strcpy() with __get_task_comm() Date: Thu, 13 Jun 2024 10:30:43 +0800 Message-Id: <20240613023044.45873-10-laoar.shao@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20240613023044.45873-1-laoar.shao@gmail.com> References: <20240613023044.45873-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: 34gxznkg8p978im676qow461x6mzxi1t X-Rspam-User: X-Rspamd-Queue-Id: BEB4D40002 X-Rspamd-Server: rspam02 X-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Aez21glp621AH0jxTp3iYtYdyc3W8ZSqdX6O/hUdPoyrI4F0WWPIB/kWA3+AFTm0ON9BtzqXqvxTrbhddjm5NPoUj+L370cF0FjSVLPd9YSvGABumpRoE9lidjHhuPIJC2LROki47zg3G9oXEpHr90S9ImUgEpmX0MNiwTOvlUKu7j3q0IJe3r6Zxpmbu4PrpAxduRAiqL6y7McCIOvjbulfjl/7oWgfdS4YWKkUxaR046zsLRJ3kHVXmTB7WkIkGip8bqymCxeUYsgX5zjFWzZMvXR+8eK2ZvkeeDyTfqh9GYM/Q7eakW/SsrnPF6FsDStYtKfW0F3rJOQYhtn3QTH6FMJ/OUcCEkCURtpR6W/ZZHy/wW4Xje5NBusKTWl1EP99OOQemDWhew4XevR37G/8zgnyaAL1mujFrYVmj5rOGAQx8IwyV+U953iWLOg39Ig7wG51kWacR01zD56sEs6DVUinXb8TzPxWsEi4nXdnimlzUjcZvWNXUX1lOI+o6fSOAfxsBT/ZNPLPTw6S8iAPPDdEJKxWAJ3PdygBJCgp2jvFbvAnMUijDNGBgmxlt3ElXB6m5JPzXVWXOi4XGeQsg/SC 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 d914b23256ce..37fa3b69df45 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1942,7 +1942,7 @@ static void ndisc_warn_deprecated_sysctl(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(-)