Skip to content

Convert all users of strlcpy to strscpy

Kumar Kartikeya Dwivedi linux-fbdev linux-tegra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13staging: comedi: Switch from strlcpy to strscpydrivers/staging/comedi/comedi_fops.c+2 -20 replies
2/13staging: greybus: Switch from strlcpy to strscpydrivers/staging/greybus/audio_helper.c drivers/staging/greybus/audio_module.c drivers/staging/greybus/audio_topology.c +2 more+8 -84 replies
3/13staging: fsl-dpaa2: Switch from strlcpy to strscpydrivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c+3 -30 replies
4/13staging: most: Switch from strlcpy to strscpydrivers/staging/most/sound/sound.c drivers/staging/most/video/video.c+4 -40 replies
5/13staging: nvec: Switch from strlcpy to strscpydrivers/staging/nvec/nvec_ps2.c+2 -21 reply
6/13staging: octeon: Switch from strlcpy to strscpydrivers/staging/octeon/ethernet-mdio.c+3 -31 reply
7/13staging: olpc_dcon: Switch from strlcpy to strscpydrivers/staging/olpc_dcon/olpc_dcon.c+1 -10 replies
8/13staging: rtl8188eu: Switch from strlcpy to strscpydrivers/staging/rtl8188eu/os_dep/ioctl_linux.c+1 -10 replies
9/13staging: rtl8192e: Switch from strlcpy to strscpydrivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c+3 -30 replies
10/13staging: rtl8192u: Switch from strlcpy to strscpydrivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c+1 -10 replies
11/13staging: rtl8712: Switch from strlcpy to strscpydrivers/staging/rtl8712/rtl871x_ioctl_linux.c+1 -10 replies
12/13staging: sm750fb: Switch from strlcpy to strscpydrivers/staging/sm750fb/sm750.c+1 -10 replies
13/13staging: wimax: Switch from strlcpy to strscpydrivers/staging/wimax/i2400m/netdev.c drivers/staging/wimax/i2400m/usb.c+5 -50 replies

Reviews trailers per patch

3 of 13 patches have a Reviewed-by or Acked-by.

PatchMarc DietrichRobert RichterAlex Elder
1/13
2/13R-b
3/13
4/13
5/13A-b
6/13R-b
7/13
8/13
9/13
10/13
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 00/13] Convert all users of strlcpy to strscpy

This series converts all existing users of strlcpy in drivers/staging to use strscpy instead.

strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string.

This silences the related checkpatch warnings from:
5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy")

The conversions were performed in two steps:

1. The following coccinelle script was used to identify and replace call sites that expect truncation.

$ spatch --sp-file strscpy.cocci --include-headers --dir --in-place drivers/staging

@strscpy@
expression dest, src, size;
@@
-strlcpy(dest, src, size);
+strscpy(dest, src, size);

2. Each individual automated conversion was rechecked manually for correctness.

Kumar Kartikeya Dwivedi (13):
staging: comedi: Switch from strlcpy to strscpy
staging: greybus: Switch from strlcpy to strscpy
staging: fsl-dpaa2: Switch from strlcpy to strscpy
staging: most: Switch from strlcpy to strscpy
staging: nvec: Switch from strlcpy to strscpy
staging: octeon: Switch from strlcpy to strscpy
staging: olpc_dcon: Switch from strlcpy to strscpy
staging: rtl8188eu: Switch from strlcpy to strscpy
staging: rtl8192e: Switch from strlcpy to strscpy
staging: rtl8192u: Switch from strlcpy to strscpy
staging: rtl8712: Switch from strlcpy to strscpy
staging: sm750fb: Switch from strlcpy to strscpy
staging: wimax: Switch from strlcpy to strscpy

 drivers/staging/comedi/comedi_fops.c                      | 4 ++--
 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c           | 6 +++---
 drivers/staging/greybus/audio_helper.c                    | 2 +-
 drivers/staging/greybus/audio_module.c                    | 2 +-
 drivers/staging/greybus/audio_topology.c                  | 6 +++---
 drivers/staging/greybus/power_supply.c                    | 2 +-
 drivers/staging/greybus/spilib.c                          | 4 ++--
 drivers/staging/most/sound/sound.c                        | 2 +-
 drivers/staging/most/video/video.c                        | 6 +++---
 drivers/staging/nvec/nvec_ps2.c                           | 4 ++--
 drivers/staging/octeon/ethernet-mdio.c                    | 6 +++---
 drivers/staging/olpc_dcon/olpc_dcon.c                     | 2 +-
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c            | 2 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c           | 6 +++---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +-
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c             | 2 +-
 drivers/staging/sm750fb/sm750.c                           | 2 +-
 drivers/staging/wimax/i2400m/netdev.c                     | 6 +++---
 drivers/staging/wimax/i2400m/usb.c                        | 4 ++--
 19 files changed, 35 insertions(+), 35 deletions(-)
Signature · 1 line
2.29.2