Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp367375lqj; Sun, 2 Jun 2024 02:04:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjl2/LE1iViFmM8a48n56pwRo1iEkndLbuStK5sIPFbF79/0ynxMmlaN+wDdS3w3KiPxpv5GUv3YVLsjfoNdB7dXgpa72Lon2FhRai1w== X-Google-Smtp-Source: AGHT+IGdk/lW6V5TzeQs3W7MMAcdq3VoU8II0zqDGqPNJQvZdxR/9/HtGXqIucNrA6PhR0e2ayVF X-Received: by 2002:a05:620a:4691:b0:794:f60e:c050 with SMTP id af79cd13be357-794f60f260cmr728324385a.71.1717319075645; Sun, 02 Jun 2024 02:04:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717319075; cv=pass; d=google.com; s=arc-20160816; b=G3eWvXFxiyV2MTiOjt/zw2uxXjzZqJdnjdT1LlfF21aUxZ/W1HHMTv7MY1SlBfHzCu +D2Y5Lu9XRjFNR5u6c2sCHInX3yMNrwGUPHBCSZL/QXjW/uHXQ4NYeWhgwJgc80n+Nv5 t9/KkXgFn9CN0UMq22uegkG+vRfcUVw5aLygErXtuiqEcH7NCnrCV429OC0SefaNGuOa uErB6FkCVPRE1PoMDPBPBtFLaQLmWk+eBQ60xqZ3fkkZaAQ6a+eVbYvhCJkvijo32Qhi qSGWaL6e88bXWKaxkVneDgzvG0YdvQHn53u4E1Avgu2cTtz/wy9Vhckd7gAfgwIENTlh pqkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ZNshTSTyMNzdhU8F6OTByctUHT0mk+WbuONPSHCezXw=; fh=ylN4Cd/TA9dGdExcoE5MwVGhf5DZLuARle8+eOkYbzw=; b=06Dx5tBPezrAmybEhPLrYaTHToBty3y5Xm2Y/PEP9ftuGajqSHti4EVJUJdXTolgj+ Qx9TW31LK3qAr+u3x0Zpf7E+cd1Sm+yHB8PU881PmiuqTtDsY+0S2+VUC68obHKVSyLu QB+DerOKZCRecurlaSqcdT8kx5ZUUgUy7eezGngBcS213gRqM0yN2fTfp+cY+QGxwNsj tyClY89CJrKwOA0HuPvBEhhcaNIxUGL/ZsXCfoAUOSiMmknhu6bdPAejfkzWcrhqxgt9 sUVlV/SOXdDP4/PidhA+xRwtOYAr6wkaC/RgVXzqgGl455BuMjfd3dIC9E/KT6B/vq/U MmxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-198171-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794f2f05651si583700085a.44.2024.06.02.02.04.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 02:04:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198171-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-198171-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D51E01C20DBF for ; Sun, 2 Jun 2024 09:04:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7718F3F9EC; Sun, 2 Jun 2024 09:03:03 +0000 (UTC) Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 548883D971 for ; Sun, 2 Jun 2024 09:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318983; cv=none; b=Ibv1jhseMY2VqMwuAzSGaIdv6lFWxilm3+/Z6qrgUvzJsmXXgTUu6Jipqk3aDh5pT1kLG9nHZ2JVPV5r2ltOhtPyn8YJHv+SHqgAHkwebgc2jSXHWx3n2H1JU3wDLcOUU3lXgWUee05GTBpW0z5CPTLTaQ944H5n1jy5ftkVerw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318983; c=relaxed/simple; bh=Zev7O1OaJPuWxSkFHl6udbLp67nkr4VjyCzglGcW7E0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lxr3N80Kn1wpDLhIBPTfhMmEDE1Ev/60/6xQAWNPr+O+FCMx2djeXGHmd0HE5No2lZpjL3KNRzOBUvg4wLqKsVSJLbaCOU3+5gz3EV+uRoozSu/d/COx1Vi3ybFlIF4CibQlutSpyMYMbqJc3hjkgpb9Z/Jx0P5jtnorLUiOrjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id e4aa8b06-20be-11ef-ab01-005056bdd08f; Sun, 02 Jun 2024 12:02:52 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 4/7] platform/x86: serial-multi-instantiate: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:57 +0300 Message-ID: <20240602090244.1666360-5-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use 2-argument strscpy(), which is not only shorter but also provides an additional check that destination buffer is an array. Signed-off-by: Andy Shevchenko --- drivers/platform/x86/serial-multi-instantiate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c index 97b9c6392230..3be016cfe601 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -131,7 +131,7 @@ static int smi_spi_probe(struct platform_device *pdev, struct smi *smi, ctlr = spi_dev->controller; - strscpy(spi_dev->modalias, inst_array[i].type, sizeof(spi_dev->modalias)); + strscpy(spi_dev->modalias, inst_array[i].type); ret = smi_get_irq(pdev, adev, &inst_array[i]); if (ret < 0) { @@ -205,7 +205,7 @@ static int smi_i2c_probe(struct platform_device *pdev, struct smi *smi, for (i = 0; i < count && inst_array[i].type; i++) { memset(&board_info, 0, sizeof(board_info)); - strscpy(board_info.type, inst_array[i].type, I2C_NAME_SIZE); + strscpy(board_info.type, inst_array[i].type); snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst_array[i].type, i); board_info.dev_name = name; -- 2.45.1