Message ID | 20240613023044.45873-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 B49B3C27C6E for <linux-mm@archiver.kernel.org>; Thu, 13 Jun 2024 02:32:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C9B16B0082; Wed, 12 Jun 2024 22:32:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 479726B00AF; Wed, 12 Jun 2024 22:32:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31A186B0095; Wed, 12 Jun 2024 22:32:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 125C76B00AF for <linux-mm@kvack.org>; Wed, 12 Jun 2024 22:32:28 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C8C1A1C2DF4 for <linux-mm@kvack.org>; Thu, 13 Jun 2024 02:32:27 +0000 (UTC) X-FDA: 82224291534.08.5EA0642 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf13.hostedemail.com (Postfix) with ESMTP id 030072000F for <linux-mm@kvack.org>; Thu, 13 Jun 2024 02:32:25 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LogUCoCz; spf=pass (imf13.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.177 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=1718245945; 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=ByPZqEdQZBBtzQ6Ut5Ro8SR1Vw4SYts83oZvgSR+UR8=; b=DMbRUUNM3GHvX0o40Hy/XlzijvFqfCYVkn2xG2ebrZE4OfZhYO59601N8ugOZD3M5SfHAc 69dOhPcTpjVqKJmKfW+Cx7T/S5inGwlKiiimMnsT6ZGibeFrbLYYXXDZh+UsrjJOl75Mgz p6A9P2MNGuo7Uzr3l3mKlL9sOpbJsg4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718245945; a=rsa-sha256; cv=none; b=3RHZiczPKVp8+KasQg+Yk/qEjgxsPbKPEYbE1S/91r8vaRbyQzgv4/v2/zNfb5ED1U/wEv ud8UwYGWg8WMlg/pxyYOMGvTCGKs/NbFpnNUvOnSA7vofTfqFVBjO8+av3sdUeKgykJ0BM eikAWBqUSjFHXiFqkFKiLYviFvJyINw= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=LogUCoCz; spf=pass (imf13.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-70413de08c7so347970b3a.0 for <linux-mm@kvack.org>; Wed, 12 Jun 2024 19:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718245945; x=1718850745; 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=ByPZqEdQZBBtzQ6Ut5Ro8SR1Vw4SYts83oZvgSR+UR8=; b=LogUCoCz2U9U4bpIjRGrktc+Luc4gyqtNSRq5CedQhNLPwG6UQK3K37M8tcHcXFL3a q7h2CpRdmMkqsqwpKQRHtjznxGf1uRuj5F2z+IQYmIKdxVYjEchWf+1blJkB8PkbCOHJ Bj6EKXDhOLgv33bJJ2JpsZkhS3Kt7eQ8JzVvRQJPuxyBfYfcT5KdZ7hvDNDQaLPCGNML rw2I4sS/kf+avZOEBCGuR+DZs7wJvcOqhSiwyUJpfWQCQWXA21uRERE8FjDHGX31cCLI Vwmuoi7psuSPzOCvDmk0RcNcNfsvleyiPSMs2EVrR1XQkVndCj7wKpfq3aAXywv83aqt KUbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718245945; x=1718850745; 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=ByPZqEdQZBBtzQ6Ut5Ro8SR1Vw4SYts83oZvgSR+UR8=; b=Nnpduve28xLQeJZhk2BADB5AJX1PpDPZTdUQ6r9AMWiqljrlZIIAye4g5bzoMIjLaB K9VRDCa1mMQzXjzeWcPqkk/BvOt1QbtkWV377fUFaLDedWOTgFxDqkluwL3h7l9fZRpJ v6EH3/ibi5fr6quNmzMtaAA53nsxT0gtmYOhPxM3AmQZOVVzQRDa8N0ORsEmI9HB65Xx hIPXBGhe6Th60Nh1sHAe3HVIuM9TNT3Jrarv1kCODiDiYRS6J/DmHxlit+fVLXMAhVs4 A+VSz5jkTM4miY7kjzbnazgPVeLbYVv7hNhAKv8hKhdrk0zAcY0o/6iJ7Rx5yUZ17kZg u1tw== X-Forwarded-Encrypted: i=1; AJvYcCUJsUwJ/L3zg0RyEQfiFqsjPBHcnYYyrR8X+zsoPVXV0m3DkhHhbnrQo9MfGsTlxP704cNC5ORyPmrVV4MlEMmumoA= X-Gm-Message-State: AOJu0YxV8aPe5af7xa4ftY2kg/ArrhBFODhoqPlcM/NRkbrXv57naoXo 4QwB/d9J70VrrOq1LYcSFLYOoyDPTx/SBnoDIafV11p1KJcMX0VX X-Google-Smtp-Source: AGHT+IE+I63Tcz7mU3dbe4p80REUOFhGXlU1vxQyrrx4b613sOPf+IM/heFPON96TqCsfc2pgVpt6g== X-Received: by 2002:a05:6a20:840c:b0:1b6:c527:7e42 with SMTP id adf61e73a8af0-1b8a9b1eb09mr4050153637.3.1718245944827; Wed, 12 Jun 2024 19:32:24 -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.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jun 2024 19:32:24 -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>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch> Subject: [PATCH v2 10/10] drm: Replace strcpy() with __get_task_comm() Date: Thu, 13 Jun 2024 10:30:44 +0800 Message-Id: <20240613023044.45873-11-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-Rspamd-Queue-Id: 030072000F X-Stat-Signature: fcexyteu4unmbgeomb16xib61tgr5ie6 X-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BCq0zSfycUL5lfcGO+IRkgiruuKBCdoV7WqkGUo5kDGoz8yJ93g2kV7JphKMy6ekq4FU6eeq/dBDJQWaGFcGgiw81jJHiuQUhALq3E2wEphHaZPZIyQytMCX5IEhuMqdBxRSRSRM3cdDjrnD7YUc9+HSaKwcLxk6TvGVwB5AUv2DIDrteRJIj5IXsPJG/e9DVpsewyToQIg5xnzqGGvq9KFCfM/fx0NsO6/sNmCooiEfvzB2L+twqz2zP94NwZG5hceVXhh+ghyjhpz0b+s6xzlEHsuNxnoafSe4vqx+N86h/9j2Ow5G5HfbodkfNoqcT78PLM3nzRxon2Mtb2bc3++5f1PeqmXaAUjJFmRJw2n9u6E61EVU/Z71G25upTRJaOlR6LW/s9wKPOcNikihLeEPuSIn2TbG8imG4pGQAV18oB/H2fDtX8n88Wc4SFg6Qd7seo5wx/qpiYVP6HFBzJ7lQ6URfh9I2CbVk0r4zo/2bcA30kN85mbPc9wu39hCr26k41yfztsfvarWRG/VrOlwDvx/vhE6BCUbq8rGLqmZ1sByDnQVwE= 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/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 888aadb6a4ac..25262b07ffaf 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -868,7 +868,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, INIT_LIST_HEAD(&fb->filp_head); fb->funcs = funcs; - strcpy(fb->comm, current->comm); + __get_task_comm(fb->comm, sizeof(fb->comm), current); ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, false, drm_framebuffer_free); diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 625b3c024540..b2c16a53bd24 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -1411,7 +1411,7 @@ static bool record_context(struct i915_gem_context_coredump *e, rcu_read_lock(); task = pid_task(ctx->pid, PIDTYPE_PID); if (task) { - strcpy(e->comm, task->comm); + __get_task_comm(e->comm, sizeof(e->comm), task); e->pid = task->pid; } rcu_read_unlock();
To prevent erros 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: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@gmail.com> Cc: Daniel Vetter <daniel@ffwll.ch> --- drivers/gpu/drm/drm_framebuffer.c | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)