From patchwork Fri Nov 1 16:38:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13859600 Return-Path: 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 C5B63E6F06E for ; Fri, 1 Nov 2024 16:44:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5918F6B009A; Fri, 1 Nov 2024 12:44:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51BAC6B009B; Fri, 1 Nov 2024 12:44:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3949B6B009C; Fri, 1 Nov 2024 12:44:34 -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 1F6966B009A for ; Fri, 1 Nov 2024 12:44:34 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C95E516024E for ; Fri, 1 Nov 2024 16:44:33 +0000 (UTC) X-FDA: 82738098954.15.EB9E577 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf29.hostedemail.com (Postfix) with ESMTP id CDA32120022 for ; Fri, 1 Nov 2024 16:43:53 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=eQ+iv6hm; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf29.hostedemail.com: domain of mcanal@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=mcanal@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730479352; a=rsa-sha256; cv=none; b=JoLmDgNYTqMsTrzxIxtnSomDi8w1P/nS0jh7bZIMJsgBN1e5+3Gb7rnwCthfR11glQpODg Doew4ixC/4hkS2j5Prv5kNhoY4wtq8LbXnJ5j5q2NY976vIRF+HOrA2kUaSmMV3/syY7gW XAeEnlKq5gQmKmEZaG5uo1dsbKX3RHo= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=eQ+iv6hm; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf29.hostedemail.com: domain of mcanal@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=mcanal@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730479352; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SzEBSUiqX9q6QOwH+3lfpF0a+846J9p9dlVHwog/yj4=; b=E/KHWDpIc8NwWlPa2hRPqQcfcjj2dskUsZhuqQf7VJTBfGBbXMtEYsFWbiI5hfyKjLIcs/ QL0KLJ8HQfKQ7j8R7Say/ZjU2l9ElNifZzx9puhfCEM1dxCf0hwdrgZJAEdJe3ByZpAew3 hUi3yk1XlR1VB4TeStzwvh/OI4PjqTw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=SzEBSUiqX9q6QOwH+3lfpF0a+846J9p9dlVHwog/yj4=; b=eQ+iv6hmi1RyhhdT/7e0AJyq0B jnteK/4rybFsrn3485KaB8QP2pVyhzHadOOUIz/oxg3ZidSZ7ij8xA+/uIxEuPw12rRql3VrwOjcE W+G2UjuHUX5HL9dKwAZKKp1xHKX4lQIJ6e06etrULMGih7yS61+d6YlpnPOCf+AAEv9TZmd5TwEwe oonSy4aLoCg4zwQRF3Wrb+PAmlz3jrLapEt6eklaoa6t4W7rEa6FpBnZO5YlLzn0vvyJAfiWQK0uS 6r+04wDfA8S/4kJpypl+TGZtiAFIVCN45jmmjHOOVwP6/RWoivCXcWlWNHt++4t4lzcMQmgJvTfvO ApQitRBA==; Received: from [187.36.213.55] (helo=morissey..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1t6ul5-000V38-3t; Fri, 01 Nov 2024 17:44:24 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Jonathan Corbet , Andrew Morton , Hugh Dickins , Barry Song , David Hildenbrand , Ryan Roberts , Baolin Wang , Lance Yang Cc: linux-mm@kvack.org, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, =?utf-8?q?Ma=C3=ADra_Canal?= Subject: [PATCH v4 5/5] mm: huge_memory: Use strscpy() instead of strcpy() Date: Fri, 1 Nov 2024 13:38:46 -0300 Message-ID: <20241101164313.1073238-7-mcanal@igalia.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101164313.1073238-2-mcanal@igalia.com> References: <20241101164313.1073238-2-mcanal@igalia.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: CDA32120022 X-Stat-Signature: pg7go3gec3yiygefyh9hubh4qtqdi3w7 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1730479433-460831 X-HE-Meta: U2FsdGVkX1+HhW+yCtcaiWAQZZplaMMMPnyfTcVWy1upj4POZmz9ZHXzqaT8GDLbhVZIFrchdChcznknP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t2/iTc+bHTfpaxVW+za4W0DQ8BvXKW+cn/9RKNKGLwQ9W/hqng/sjs3bPtWxoauFdn2trbpSQXQSvr2noy7UXz9ruZrfW/K7aVuzvm69obvhTitvMhiQkv5ejL68NNFa1p58dqVkATtziOuCyBYGA+tw+BacFR9zoceW0fTRiADYzRhE0WlEse+KDFrxqaf2JzJ8keLY/AOz4N73hGJCEmObp7nN2Uj9SqwI17lLkHYVDLbMCXfPgZiS/dE= 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: List-Subscribe: List-Unsubscribe: Replace strcpy() with strscpy() in mm/huge_memory.c strcpy() has been deprecated because it is generally unsafe, so help to eliminate it from the kernel source. Link: https://github.com/KSPP/linux/issues/88 Signed-off-by: MaĆ­ra Canal Reviewed-by: Lance Yang --- mm/huge_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a6edbd8c4f49..1ebe18ec4560 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -969,7 +969,7 @@ static int __init setup_thp_anon(char *str) if (!str || strlen(str) + 1 > PAGE_SIZE) goto err; - strcpy(str_dup, str); + strscpy(str_dup, str); always = huge_anon_orders_always; madvise = huge_anon_orders_madvise; @@ -4167,7 +4167,7 @@ static ssize_t split_huge_pages_write(struct file *file, const char __user *buf, tok = strsep(&buf, ","); if (tok) { - strcpy(file_path, tok); + strscpy(file_path, tok); } else { ret = -EINVAL; goto out;