From patchwork Mon Oct 23 09:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Straube X-Patchwork-Id: 156758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1161841vqx; Mon, 23 Oct 2023 02:01:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqAV/vZLnPj/71K/PDShJaSBTaPAniU9dzEXYFeIqrC6mYZfjM5+FcWKebGdfpUEzpW3P2 X-Received: by 2002:a05:6a20:6a04:b0:161:28e0:9abd with SMTP id p4-20020a056a206a0400b0016128e09abdmr6889342pzk.16.1698051698980; Mon, 23 Oct 2023 02:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698051698; cv=none; d=google.com; s=arc-20160816; b=0HRjVTsOePE3KQXbAPXKoU9FxBzabQWTsT0iX47lfvO3X+VEfLqqC+fv+2KPlJjb3n 0Tr5iLsgVTuHLAXccMETS5f2AU13p9cHJ7/MHwjCMU/AIxJ6VYokEBk5HDKhhf7NdmLi mrozlq3P3IS9Hca5jU6V3hjVRkxXJUnLkb9UXebIWFZakUy41PYIG0yKNsJPB2Ohm2QZ UnJJ6MT8IxIridTAJTBnFZ7WM0XltshQEcQB8d4pcHidkVZfaQAd5eBBMJKpp/hmOvjj fIM9gO7jfukzSUB0dZpUri0sJP8Mj3km6ah6OWNwNubb3ik37j57T0sRK9pqMIMMek1k N7+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8+GHphwBFjGwN9m3MPCMJRC4fLS4F2GugdfMMYNHe6o=; fh=GuFn/A1ox6ZHngcYhf45j0BH3ACLWjI8P1lYZj4i0JQ=; b=gh9bsZNwTF/bOML8KpoTQp5Bx35/FoFsfCWAsqxebjWrP8uVAbtFaVSKyAMtAMAnKk 8sgeNVdS4aUnlUwPmp9gMZmLmgH3/PM3WeP4JgbnER8l2KkSwPYoc1Nc6OGRyBgj6QkE 1gN4N6eJGK30tRXNjtmtxIOw50RNhLNuQxqFQHMHwSskuVGtMnL0+ENqOSqq0QJvjPT7 Wj5L5Y8NaIHeiic0eKnYdYbdSxDdVAoQ3B1deJtD45Z7PQpHfiN5+o+CskZptw1rYx19 K6tWPntrI1nM9s6hsoOKSLTLaf4rkjusIoU+H92bleuYvvoKCckQIWUKwnUa6H3wt88Y 429w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WTRBXJvT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id fa36-20020a056a002d2400b006bd92819450si3562603pfb.170.2023.10.23.02.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 02:01:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WTRBXJvT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D03B880A9AB9; Mon, 23 Oct 2023 02:01:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjJWJBU (ORCPT + 27 others); Mon, 23 Oct 2023 05:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbjJWJBS (ORCPT ); Mon, 23 Oct 2023 05:01:18 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23FECE8 for ; Mon, 23 Oct 2023 02:01:17 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-99c3d3c3db9so444139166b.3 for ; Mon, 23 Oct 2023 02:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698051675; x=1698656475; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8+GHphwBFjGwN9m3MPCMJRC4fLS4F2GugdfMMYNHe6o=; b=WTRBXJvTc0v2eLMV4legekFE5r2g+LCyuIHNJWb/RWkW2oSILa+j6Vow+E8QLwQIxV UovUiO5obAuJfA78GNWMuIDU6lsc41MjbfzaEIAXrVb75ZIp2vAXS49whOpRsJvjybRA Rj/haiC6en2y+mGC6aSP4pY4XjdMRP5SQDfle71a4N8JzVC7y0IiWFlvBH4Ip/rni5Io 7PHpPc2+m4DNpHSXb9t5O38IytwcJTfv6fBKibC8L9Ce4JTU4LhXyVcNDVPQOlESbYRe xjdKMqY9BeDu6f06BzarzW+H2DmyQfQ1bRJdlbm9CcxZgBKYsOKk1tEVl3Rlih7fQVNP J75A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698051675; x=1698656475; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8+GHphwBFjGwN9m3MPCMJRC4fLS4F2GugdfMMYNHe6o=; b=GbI9CSaWelTrCkHpFM5Lc3L157Xl6cC2Q/Sd3WshJEDQgvnul6Le2UrICfnPiVf3Pe Xmf/NtdbFFhgzLddEoVZg0wcQUYk73wU8ZZCf0FGaLcM+qNU8mmALsUVUNhk8hkDT6jy tldy3eTvM2ORLT/uFQA8CA8WEqlNKUWv2vdIcQmCi8dQYkWV+tI8m1SL/1cuGTf6Z+q/ Z3yHV6kNbJ5pu98kAKQkfH+SYs19vEAixMbE46Z8ffbU0gHrRm/BiDCq7R2SMBjVm60q NT9zbGB/IR1m8pw8XX2VTuqd8cGHsjFh9ZouPVUubfkBk3HkZ/EaslRnzfosIcTxLgyT erLQ== X-Gm-Message-State: AOJu0YxuEDkbmimtRSeJ/Pg51UlkM5DBPbplMoQOVAf5m52h3Sy7wuZv qKT1lU1Hh1JmMuvu1O84lKs= X-Received: by 2002:a17:907:318c:b0:9c3:97d7:2c5f with SMTP id xe12-20020a170907318c00b009c397d72c5fmr6998447ejb.44.1698051675265; Mon, 23 Oct 2023 02:01:15 -0700 (PDT) Received: from localhost.localdomain ([95.90.186.21]) by smtp.gmail.com with ESMTPSA id y22-20020a170906449600b009a1dbf55665sm6186426ejo.161.2023.10.23.02.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 02:01:14 -0700 (PDT) From: Michael Straube To: gregkh@linuxfoundation.org Cc: martyn@welchs.me.uk, manohar.vanga@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Michael Straube Subject: [PATCH] staging: vme_user: prefer strscpy over strcpy Date: Mon, 23 Oct 2023 11:00:01 +0200 Message-ID: <20231023090001.7273-1-straube.linux@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 02:01:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780536258390784997 X-GMAIL-MSGID: 1780536258390784997 Using strcpy has potential for buffer overflows. It should be replaced with strscpy where possible. In this case the return value of strcpy is not used, so we can safely replace it with strscpy. Signed-off-by: Michael Straube --- Compile tested only. drivers/staging/vme_user/vme_tsi148.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c index d549c22da534..2ec9c2904404 100644 --- a/drivers/staging/vme_user/vme_tsi148.c +++ b/drivers/staging/vme_user/vme_tsi148.c @@ -2310,7 +2310,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) mutex_init(&tsi148_device->vme_rmw); tsi148_bridge->parent = &pdev->dev; - strcpy(tsi148_bridge->name, driver_name); + strscpy(tsi148_bridge->name, driver_name, VMENAMSIZ); /* Setup IRQ */ retval = tsi148_irq_init(tsi148_bridge);