Message ID | 20240812022933.69850-9-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 21731C3DA4A for <linux-mm@archiver.kernel.org>; Mon, 12 Aug 2024 02:31:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9C1D6B00A9; Sun, 11 Aug 2024 22:31:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A24006B00AA; Sun, 11 Aug 2024 22:31:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 876DA6B00AB; Sun, 11 Aug 2024 22:31:28 -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 652C66B00A9 for <linux-mm@kvack.org>; Sun, 11 Aug 2024 22:31:28 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id DA4B5120370 for <linux-mm@kvack.org>; Mon, 12 Aug 2024 02:31:27 +0000 (UTC) X-FDA: 82442017014.25.689CAF0 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf17.hostedemail.com (Postfix) with ESMTP id 13B2140016 for <linux-mm@kvack.org>; Mon, 12 Aug 2024 02:31:25 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VNmplp7a; spf=pass (imf17.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.174 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=1723429852; 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=lQq52x1okLoFlEdSdcWpS9opM5nCjcuUg5Jqdy6Utiw=; b=YVJlM7fQHzp5VodFCC0jrUTD+WrgJalSvjF4dW6rHTtafRFaLufFt4QORiPShCBZFQkDNg qqT8KE4yEcAqgqpPlJGOH+G0MC2DLrlUOjeKOIaP7pvyEX2oVco++4Gz7lBmIaefGmbQGa a1KXcQ0abl589Eg9fSp8OqgEDtLVKyk= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VNmplp7a; spf=pass (imf17.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.214.174 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=1723429852; a=rsa-sha256; cv=none; b=CmRA/bA+zYeaZeur+vKp/stYJA+X9H9TLi8HElQ14J9M5QX81eabK47Xj3gOy2ErX34kFE B070wXCu5xEU7r0UeBznjcqFp4nXfiGCbjKZgExgRhPRTMhkKL8tbeIk/tWlEMkaQuxnCa 6ylZJ9PchM80TXhKk59LX3A0MwOxNgU= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1fee6435a34so26516265ad.0 for <linux-mm@kvack.org>; Sun, 11 Aug 2024 19:31:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723429885; x=1724034685; 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=lQq52x1okLoFlEdSdcWpS9opM5nCjcuUg5Jqdy6Utiw=; b=VNmplp7aE348rug2qSwHJ98aI2+ekjUB9Zv+e2fd3f6xPV6Fwbmz82x+sEe+ArslxA KQn/gv4jjzfS3YS5elm21s1d5wFvddULMFCcshdz9ajBCQ2ih5skiRUib9Kud9/6WtBE HQSDSXMVpGCHsbT03U9o732SJ7VAasZu3u/o9+CcZRpdyvaxkHX6buIWt3Xz8poMUmod sS1+9IY4zTGWeUYKYvdE8+fxdRSBIWIBP1D2RAcSOd9FkJU0McUKXQMfDuOnjT8TuyE9 GLSkK6qXvxiMT07leJx1tiT8I/rqS8hy+BEn1brn6z/CPEljm32p0+h5ntb/TYfe23va zjBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723429885; x=1724034685; 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=lQq52x1okLoFlEdSdcWpS9opM5nCjcuUg5Jqdy6Utiw=; b=ut2GuBcGSOYbP9sxb8iMpUxomcO70VtnlZ6k1XBnWexA3Uekm5ehZuGY9k0HHCRg7V STAdgieGLgx6Jvp6g24pbgvMSbEzzhe4bMpCCAWyrcRlnAyAMeoQqQyVkqo4XIdQuDs0 vjGiP2rfEewA+LoAAP0yUEfCQBwuFgY+Bb766EOSFO2KGY6fbbc1wQkJDag54aR6ukls Y8qfwIpRHSawblJS+FlVxytWtyuTa9qed6X0czg7ct9a9fHT5ypBchWoUPJQXXpHkOdn XoW+7qNtWy+cx/Y3cJNZaeiM6OTy5VGrLz/VxZBDatoI5gl8lpLeB1EadeVBh/3K4xsE mHGw== X-Forwarded-Encrypted: i=1; AJvYcCWLN+yqvG8K+jxlys1ipbhR3mzc7m6ZB2aZOY6kse3LqRqOVZpz0+M8rjQqUV5dy06avo6djsBxdBtIa+Nk0HiLQjE= X-Gm-Message-State: AOJu0YygSyd/FEoGBzzEIinse3DklPCpH8MQ8oKjaF3P0Q8RgyoaWEJF dyn7Sgk/hC/sMCD662h7GxM/576UTCHjs8l4BmIvNKKT4Mkpt1hM X-Google-Smtp-Source: AGHT+IHaetHTBTCym7N0t424xRy6qtmLiFL/7ctUucHwtwIF7cfl/lI/MF8VrMeOi3ytURGCyHANzQ== X-Received: by 2002:a17:903:249:b0:1fd:7664:d891 with SMTP id d9443c01a7336-200ae5cfb6amr57289655ad.44.1723429884796; Sun, 11 Aug 2024 19:31:24 -0700 (PDT) Received: from localhost.localdomain ([39.144.39.162]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-200bb9fed69sm27884765ad.188.2024.08.11.19.31.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2024 19:31:24 -0700 (PDT) From: Yafang Shao <laoar.shao@gmail.com> To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, ebiederm@xmission.com, alexei.starovoitov@gmail.com, rostedt@goodmis.org, catalin.marinas@arm.com, 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 v6 8/9] net: Replace strcpy() with strscpy() Date: Mon, 12 Aug 2024 10:29:32 +0800 Message-Id: <20240812022933.69850-9-laoar.shao@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20240812022933.69850-1-laoar.shao@gmail.com> References: <20240812022933.69850-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 13B2140016 X-Stat-Signature: nbsxix7hfgj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rTwcz1/9wTyTFpwPUriYx8AB5y8rDovoW+RD+UZJRrIIv+Cdl1W23OCVYJostDWaHz0ggBHUKj3aoWLE+1Zu31yg9V40iCOCSSHZWpQ0MmGkbdQKWOPfAcXqBw6rZCMocMyOV3pRMgOLZ/MKYSW2KLupLmeT9tYiIWcv4qXtN370aEj4tYSdPeTOx7JrNsT78Gsd+G8GMOQt/M4ZoTT52Ntl5UN0lp58bVM76mpRf6HCzF/1K6umNhsr4dJm29s/j1cMW2qORGg0+naKI4nDodwtRqWnpA6+iQmzOS0IUdOf1hmLnAsE3i0zpcdifXAPl9kA5YtOokuGCvlkkRl03spU9WGsnl4NTZDphJIFlrw5xdtc/p0AVDLacHS/+fqyIUoO8MAICaoM1OPT9iBlckGAChVWctm9tAAUkd3CUG+zOdxjQJv3JYfvG2zMDt/VFacW0iwAeYIYqDJYMtCbx2bxtK4jr71ehHBtOG3ASLbwcFwddv4Pl5wLXjcF47Mpa5I6bjsio0uLn3o2jhnsBBcbQq6ubK54npqVKYKeyhFzQAWKKzJaS4snfuJxhoOkpBU2/S5gKbURSgt129X+1Fg== 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..bf969a4773c0 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); + strscpy(warncomm, current->comm, sizeof(warncomm)); 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 strscpy() 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(-)