drm: bridge/dw-hdmi-ahb-audio: use strscpy() is more robust and safer
Subsystems (3)
PATCH 1/1 drm: bridge/dw-hdmi-ahb-audio: use strscpy() is more robust and safer
From: Minghao Chi <[email protected]>
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +3 -3
@@ -542,8 +542,8 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev)if (ret <0 )return ret; -strlcpy (card->driver,DRIVER_NAME ,sizeof (card->driver)); -strlcpy (card->shortname,"DW-HDMI" ,sizeof (card->shortname)); +strscpy (card->driver,DRIVER_NAME ,sizeof (card->driver)); +strscpy (card->shortname,"DW-HDMI" ,sizeof (card->shortname));snprintf (card->longname,sizeof (card->longname),"%s rev 0x%02x, irq %d" , card->shortname, revision, data->irq);
@@ -561,7 +561,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) dw->pcm = pcm; pcm->private_data = dw; -strlcpy (pcm->name,DRIVER_NAME ,sizeof (pcm->name)); +strscpy (pcm->name,DRIVER_NAME ,sizeof (pcm->name));snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_dw_hdmi_ops);/*
Signature · 1 line
2.25.1
Neil Armstrong
maintainerHi,
Quoted 17 lines · On 19/09/2022 05:04, [email protected] wrote:
From: Minghao Chi <[email protected]>
The implementation of
strscpy()is more robust and safer.That's now the recommended way to copy NUL terminated strings.
Reported-by Zeal Robot <[email protected]>Signed-off-by Minghao Chi <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +0
-0
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c static int snd_dw_hdmi_probe(struct platform_device *pdev) · line 546
Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +2
-2@@ -542,8 +542,8 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev)if (ret <0 )return ret; -strlcpy (card->driver,DRIVER_NAME ,sizeof (card->driver)); -strlcpy (card->shortname,"DW-HDMI" ,sizeof (card->shortname)); +strscpy (card->driver,DRIVER_NAME ,sizeof (card->driver)); +strscpy (card->shortname,"DW-HDMI" ,sizeof (card->shortname));
Please keep using DRIVER_NAME in both lines.
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c static int snd_dw_hdmi_probe(struct platform_device *pdev) · line 567
Quoted 12 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +1
-1snprintf (card->longname,sizeof (card->longname),"%s rev 0x%02x, irq %d" , card->shortname, revision, data->irq);@@ -561,7 +561,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) dw->pcm = pcm; pcm->private_data = dw; -strlcpy (pcm->name,DRIVER_NAME ,sizeof (pcm->name)); +strscpy (pcm->name,DRIVER_NAME ,sizeof (pcm->name));snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_dw_hdmi_ops);/*
Thanks,
Neil
Quoted 28 lines · On 19/09/2022 05:04, [email protected] wrote:
From: Minghao Chi <[email protected]>
The implementation of
strscpy()is more robust and safer.That's now the recommended way to copy NUL terminated strings.
Reported-by Zeal Robot <[email protected]>Signed-off-by Minghao Chi <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +2
-2@@ -542,8 +542,8 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev)if (ret <0 )return ret; -strlcpy (card->driver,DRIVER_NAME ,sizeof (card->driver)); -strlcpy (card->shortname,"DW-HDMI" ,sizeof (card->shortname)); +strscpy (card->driver,DRIVER_NAME ,sizeof (card->driver)); +strscpy (card->shortname,"DW-HDMI" ,sizeof (card->shortname));snprintf (card->longname,sizeof (card->longname),"%s rev 0x%02x, irq %d" , card->shortname, revision, data->irq);
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c static int snd_dw_hdmi_probe(struct platform_device *pdev) · line 567
Quoted 8 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +1
-1@@ -561,7 +561,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev) dw->pcm = pcm; pcm->private_data = dw; -strlcpy (pcm->name,DRIVER_NAME ,sizeof (pcm->name)); +strscpy (pcm->name,DRIVER_NAME ,sizeof (pcm->name));snd_pcm_set_ops (pcm,SNDRV_PCM_STREAM_PLAYBACK , &snd_dw_hdmi_ops);/*
Hi,
Quoted 8 lines · On Mon, 19 Sep 2022 03:04:01 +0000, [email protected] wrote:
From: Minghao Chi <[email protected]>
The implementation of
strscpy()is more robust and safer.That's now the recommended way to copy NUL terminated strings.
[...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)
[1/1] drm: bridge/dw-hdmi-ahb-audio: use strscpy() is more robust and safer
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=110ae8a21bbe779a133c1672a1463105c9d50590
Signature · 1 line
Neil