Message ID | 20240621022959.9124-11-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 9E52CC2BA18 for <linux-mm@archiver.kernel.org>; Fri, 21 Jun 2024 02:32:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BF626B046C; Thu, 20 Jun 2024 22:32:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 273FB6B046E; Thu, 20 Jun 2024 22:32:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0744E6B046D; Thu, 20 Jun 2024 22:32:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DA3286B046A for <linux-mm@kvack.org>; Thu, 20 Jun 2024 22:32:40 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A531B160543 for <linux-mm@kvack.org>; Fri, 21 Jun 2024 02:32:40 +0000 (UTC) X-FDA: 82253322480.17.6BBBB74 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf22.hostedemail.com (Postfix) with ESMTP id D9F50C001D for <linux-mm@kvack.org>; Fri, 21 Jun 2024 02:32:38 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=M53frfms; spf=pass (imf22.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.169 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=1718937151; 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=mM/1S9T2tBYoZCgE31Q/lEbGdBggp1bwKT3yTD3UzMc=; b=mndeSSCkxyOX/+cPT1tBZBeHtzrTG7qvtgA4yxkNCU+9CBtxJi5BmFb6yAZ6szdNL2QhVy g/cenXc0CpxSfu2lTJBMdNmroDwHHhCmI27uk2X87SOkeXIXH5r6Sahe3gs3g8auqcsEfS xyY7W+wXtQA4dxwVMNufdsMJljndw9w= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=M53frfms; spf=pass (imf22.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.169 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=1718937151; a=rsa-sha256; cv=none; b=KRICp6gQnCq9Ku3JFluVYDyMWq1UZIrcKZjapUlazMA2LJBpyXPetGaphRqmkS9r1jC10v HazdtBg43C0dDO9fev1N5rwd4Gh0jb/iHYuZVntqDdxZr1hafjToUgzPk0rTQxcyxy6yAW 86vZ0n71UxC2DIbY92Tu3cEQoTDQiVA= Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-704090c11easo1257624b3a.2 for <linux-mm@kvack.org>; Thu, 20 Jun 2024 19:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718937158; x=1719541958; 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=mM/1S9T2tBYoZCgE31Q/lEbGdBggp1bwKT3yTD3UzMc=; b=M53frfmsfdIzSGuHb/4yzpvOtGT6BY9g7aHiBSk3WJ+TibMugdYlr7I4rVKYO1pZZ3 DH2AFpTKHij7D/YKLcusP/S0NYPqfyGmG5ktOll0QtcWqfHadarEohhKeRAZ0K+ydq9G bIZeDdTi/WBZkSZmqld6EgiyuZ0FopyF3rEeZho0zigjR/hu/HAUKiZwsoTAdLeQ/VK0 kqmObo+XVAfvBDPRHHUCfCeKkAB170TY+ZybFz/+A3D3dfrxjYT7tDvswfjQ8YrMtlRK +Cf7LzPwllRAV5CdkQZiwXuWGBdMUZl8I2KyL3QIBtu7YnLGSO2QBlVQDD52st4hjYNC 3V7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718937158; x=1719541958; 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=mM/1S9T2tBYoZCgE31Q/lEbGdBggp1bwKT3yTD3UzMc=; b=EvVofHp6ceO28dvVxHtW/atPTRgHFA2cKyYNMhXEa7wrdQhBRf+f7c0uM4dnEwEFbj n76M3cIvWEXzrXXLnTw7R/gIShmgJtisPFTgxcWSHgUsPbfo/PtwhbsvDaPpGGNNEYmx dEr4rcZl7Rgv8Go80XxqhGciA5Y0YpN87bJ428gtgJIWfzFoZmA6ebn+NhraNbmKmVTj 7P/Ub6khd/wOZ2nkIpKSVkHFPxPjiO6/NEsNQNC1CoF5vdrktVbIljmAGXnqkwq2H5xp ToBsCcKs4uKJU7psCku5VuLEENqX7YWZ3iBhq2tXA0ZB9JnJg5kuFnyO4ZNgMOIG8BC8 srvw== X-Forwarded-Encrypted: i=1; AJvYcCVYS4RgYmVDBstbxM0scSKu4XwcCbEc8qvzB3hnUykRBlsSTdSi0oXjvg5LUo2cDl+mVuF5D1E2xXTo+Zwx9NcbfZ4= X-Gm-Message-State: AOJu0Yzcv5kVtxI2DPdwiQxg3OikJGNmiRGCEYAPxWlkKFxLZu8+stQ+ pxH2nsYwWJ0TPgtwJKYbUXYB7OkIvWzd69B6wCz+dSUk9j5GqCKM X-Google-Smtp-Source: AGHT+IHxOQrDg8mR1N6VheTp8u8eV+XoRh0OG7Yl/1zkogSK0YkzXLknkEls7rTyfvffHbYdw2ahAQ== X-Received: by 2002:a05:6a00:9289:b0:705:9992:d8ad with SMTP id d2e1a72fcca58-70629c6de86mr9102308b3a.19.1718937157754; Thu, 20 Jun 2024 19:32:37 -0700 (PDT) Received: from localhost.localdomain ([39.144.105.24]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706511944d2sm332488b3a.70.2024.06.20.19.32.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2024 19:32:37 -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, catalin.marinas@arm.com, akpm@linux-foundation.org, penguin-kernel@i-love.sakura.ne.jp, 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 v3 10/11] net: Replace strcpy() with __get_task_comm() Date: Fri, 21 Jun 2024 10:29:58 +0800 Message-Id: <20240621022959.9124-11-laoar.shao@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20240621022959.9124-1-laoar.shao@gmail.com> References: <20240621022959.9124-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: pjb6ace3m6xoxryrqti1akaiegy3wtd9 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c4o9nBrqlo+VZz1c63iYOnyXaeo3yFnrimGZG+/s2aTBo+bldg2D9JeUrfcayatAR25KDnL2rY7Ha+Qj46i4fkLOus7pZukcNjTjn1vKSDce4PJ6p2M/HcKXA6NAFTY7qnnbjIqh+hB6kXxC21TUF+ScB5sYQyWtpGe3nrG7z28fkG1PVnyb3cFvNZrqAy3FEfgNT5vFGgyRnCYMckUjkzGAzM/6R1ohgz/QQB/RMlL/pYk9nkiupc/c9VYZHYCpB5QE7fEDtGNRou0dIn66ab1bJftiGcSkd3UG+ge+4pP9bE91W8xqKZsg2ojEPTtMYqg0886NuV4xOO+PVW4ALmmstdQZBp0/CVKtEAYRkSzxquIT2G/C83Wr+vAtljVFmkiYTlRiWEWYdQo2D+kydGN805GRbxYa/ekApCabrbqoHhT+pQ1xAxNQKRCUmha2yEsLct3L3p91UoqSh6h+Vvt4dew9cMawZZ5/svffu0btEWzETMlUOFUF6wVQGQPZQo3DjOZGpSc02G8L3rDVlYEXtzj1JlItsBzNN0rn1xK5ajJx3NfyZIxrmuoCcLZlzmwk/u7PmUQB7RUTtYSem3TqQ+1Y+6aCuPtZwyCex2k5T+who1AhWSsThxJFf9A5DJVxhoA02XF5D8ICyQJ 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(-)