From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5823CA0EE4 for ; Sun, 17 Aug 2025 23:26:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DEBB210E008; Sun, 17 Aug 2025 23:26:33 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.b="vHCvOWke"; dkim-atps=neutral X-Greylist: delayed 401 seconds by postgrey-1.36 at gabe; Sun, 17 Aug 2025 23:26:32 UTC Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3ABA610E008 for ; Sun, 17 Aug 2025 23:26:32 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1755472789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=19CADCH4ex67/f+oe/6jdXcNL5Bo7Hgf1ytFVQUJ75o=; b=vHCvOWkevczGBaSiKQOKMVduBqAKhNMXcUUYJ3VHsCcPs4N4TqCEwAtxx5W/TYeGa7mGb6 zJQK5bh1CDksTt/5z2ioQ84D8FzcKhmmZsn1yLWJ98biJ8sGNe+Rib/tjGQ5+uDV5PFaTZ DDIWkDG+FqjjYcOTmktSfgN1MSMuBaQ= From: Thorsten Blum To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Thorsten Blum , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] drm: Use strscpy() instead of strscpy_pad() Date: Mon, 18 Aug 2025 01:19:34 +0200 Message-ID: <20250817231933.634116-2-thorsten.blum@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" kzalloc() already zero-initializes the destination buffers, making strscpy() sufficient for safely copying the names. The additional NUL-padding performed by strscpy_pad() is unnecessary. If the destination buffer has a fixed length, strscpy() automatically determines its size using sizeof() when the argument is omitted. This makes the explicit size arguments unnecessary. No functional changes intended. Signed-off-by: Thorsten Blum --- drivers/gpu/drm/drm_property.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index 596272149a35..47f2891f3f06 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -128,7 +128,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, property->num_values = num_values; INIT_LIST_HEAD(&property->enum_list); - strscpy_pad(property->name, name, DRM_PROP_NAME_LEN); + strscpy(property->name, name); list_add_tail(&property->head, &dev->mode_config.property_list); @@ -421,7 +421,7 @@ int drm_property_add_enum(struct drm_property *property, if (!prop_enum) return -ENOMEM; - strscpy_pad(prop_enum->name, name, DRM_PROP_NAME_LEN); + strscpy(prop_enum->name, name); prop_enum->value = value; property->values[index] = value; -- 2.50.1