[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5aed4431-e99c-a3a1-1cc3-0f8a57e99827@linaro.org>
Date: Mon, 19 Sep 2022 10:58:16 +0200
From: Neil Armstrong <neil.armstrong@...aro.org>
To: cgel.zte@...il.com
Cc: robert.foss@...aro.org, Zeal Robot <zealci@....com.cn>,
linux-kernel@...r.kernel.org, Minghao Chi <chi.minghao@....com.cn>,
dri-devel@...ts.freedesktop.org, andrzej.hajda@...el.com
Subject: Re: [PATCH] drm: bridge/dw-hdmi-ahb-audio: use strscpy() is more
robust and safer
Hi,
On 19/09/2022 05:04, cgel.zte@...il.com wrote:
> From: Minghao Chi <chi.minghao@....com.cn>
>
> The implementation of strscpy() is more robust and safer.
>
> That's now the recommended way to copy NUL terminated strings.
>
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@....com.cn>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
> index 7d2ed0ed2fe2..4efb62bcdb63 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
> @@ -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.
> 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);
>
> /*
Thanks,
Neil
Powered by blists - more mailing lists