From nobody Fri Apr 10 21:56:01 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2575AC00140 for ; Thu, 18 Aug 2022 21:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346567AbiHRVN7 (ORCPT ); Thu, 18 Aug 2022 17:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346895AbiHRVKp (ORCPT ); Thu, 18 Aug 2022 17:10:45 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5286CD41AE for ; Thu, 18 Aug 2022 14:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=k1; bh=MAlYZYdjMoOkVSt0hnZocRFRAW2 3rAy22Au4KoReLBo=; b=ZqBje3eWFrL/IRIUKBf9oyd9hhw64JVCQZlaPRLTvPe B4cgxKXGcSCU73P5rZlkaNkGE5txJ+0SwcAV6qXhmi973XJeQ7KHTPiMMlnnRoJS hy+MygNQ6Vf0jcIH+yFhtfeFIoY68iQjMv11PGHsqgBn4jGlwtGk+x/DzVgwtIqQ = Received: (qmail 3963384 invoked from network); 18 Aug 2022 23:02:31 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 18 Aug 2022 23:02:31 +0200 X-UD-Smtp-Session: l3s3148p1@une/TIrmHn4ucref From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang Subject: [PATCH] samples: move from strlcpy with unused retval to strscpy Date: Thu, 18 Aug 2022 23:02:30 +0200 Message-Id: <20220818210230.8683-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=3DwgfRnXz0W3D37d01q3JFkr_i_uTL=3DV6A6= G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang --- samples/v4l/v4l2-pci-skeleton.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleto= n.c index a61f94db18d9..69ef788d9e3b 100644 --- a/samples/v4l/v4l2-pci-skeleton.c +++ b/samples/v4l/v4l2-pci-skeleton.c @@ -291,8 +291,8 @@ static int skeleton_querycap(struct file *file, void *p= riv, { struct skeleton *skel =3D video_drvdata(file); =20 - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); - strlcpy(cap->card, "V4L2 PCI Skeleton", sizeof(cap->card)); + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); + strscpy(cap->card, "V4L2 PCI Skeleton", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(skel->pdev)); return 0; @@ -597,11 +597,11 @@ static int skeleton_enum_input(struct file *file, voi= d *priv, i->type =3D V4L2_INPUT_TYPE_CAMERA; if (i->index =3D=3D 0) { i->std =3D SKEL_TVNORMS; - strlcpy(i->name, "S-Video", sizeof(i->name)); + strscpy(i->name, "S-Video", sizeof(i->name)); i->capabilities =3D V4L2_IN_CAP_STD; } else { i->std =3D 0; - strlcpy(i->name, "HDMI", sizeof(i->name)); + strscpy(i->name, "HDMI", sizeof(i->name)); i->capabilities =3D V4L2_IN_CAP_DV_TIMINGS; } return 0; @@ -845,7 +845,7 @@ static int skeleton_probe(struct pci_dev *pdev, const s= truct pci_device_id *ent) =20 /* Initialize the video_device structure */ vdev =3D &skel->vdev; - strlcpy(vdev->name, KBUILD_MODNAME, sizeof(vdev->name)); + strscpy(vdev->name, KBUILD_MODNAME, sizeof(vdev->name)); /* * There is nothing to clean up, so release is set to an empty release * function. The release callback must be non-NULL. --=20 2.35.1