All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: zynqmp: Replaced strncpy() with strscpy()
@ 2021-09-07  9:09 Shubhrajyoti Datta
  2021-09-09 21:12 ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Shubhrajyoti Datta @ 2021-09-07  9:09 UTC (permalink / raw)
  To: linux-clk; +Cc: git-dev, michal.simek, sboyd

Replaced strncpy() with strscpy() as the clock names are supposed to
be NULL terminated.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/clk/zynqmp/clkc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index eb25303eefed..40fbd2517016 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -163,7 +163,7 @@ static int zynqmp_get_clock_name(u32 clk_id, char *clk_name)
 
 	ret = zynqmp_is_valid_clock(clk_id);
 	if (ret == 1) {
-		strncpy(clk_name, clock[clk_id].clk_name, MAX_NAME_LEN);
+		strscpy(clk_name, clock[clk_id].clk_name, MAX_NAME_LEN);
 		return 0;
 	}
 
@@ -712,7 +712,7 @@ static void zynqmp_get_clock_info(void)
 		zynqmp_pm_clock_get_name(clock[i].clk_id, &name);
 		if (!strcmp(name.name, RESERVED_CLK_NAME))
 			continue;
-		strncpy(clock[i].clk_name, name.name, MAX_NAME_LEN);
+		strscpy(clock[i].clk_name, name.name, MAX_NAME_LEN);
 	}
 
 	/* Get topology of all clock */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: zynqmp: Replaced strncpy() with strscpy()
  2021-09-07  9:09 [PATCH] clk: zynqmp: Replaced strncpy() with strscpy() Shubhrajyoti Datta
@ 2021-09-09 21:12 ` Stephen Boyd
  2021-10-05 11:37   ` Shubhrajyoti Datta
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2021-09-09 21:12 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-clk; +Cc: git-dev, michal.simek

Quoting Shubhrajyoti Datta (2021-09-07 02:09:20)
> Replaced strncpy() with strscpy() as the clock names are supposed to

And what if they aren't?

> be NULL terminated.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>  drivers/clk/zynqmp/clkc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
> index eb25303eefed..40fbd2517016 100644
> --- a/drivers/clk/zynqmp/clkc.c
> +++ b/drivers/clk/zynqmp/clkc.c
> @@ -163,7 +163,7 @@ static int zynqmp_get_clock_name(u32 clk_id, char *clk_name)
>  
>         ret = zynqmp_is_valid_clock(clk_id);
>         if (ret == 1) {
> -               strncpy(clk_name, clock[clk_id].clk_name, MAX_NAME_LEN);
> +               strscpy(clk_name, clock[clk_id].clk_name, MAX_NAME_LEN);
>                 return 0;
>         }
>  
> @@ -712,7 +712,7 @@ static void zynqmp_get_clock_info(void)
>                 zynqmp_pm_clock_get_name(clock[i].clk_id, &name);
>                 if (!strcmp(name.name, RESERVED_CLK_NAME))
>                         continue;
> -               strncpy(clock[i].clk_name, name.name, MAX_NAME_LEN);
> +               strscpy(clock[i].clk_name, name.name, MAX_NAME_LEN);
>         }
>  
>         /* Get topology of all clock */
> -- 
> 2.17.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] clk: zynqmp: Replaced strncpy() with strscpy()
  2021-09-09 21:12 ` Stephen Boyd
@ 2021-10-05 11:37   ` Shubhrajyoti Datta
  0 siblings, 0 replies; 3+ messages in thread
From: Shubhrajyoti Datta @ 2021-10-05 11:37 UTC (permalink / raw)
  To: Stephen Boyd, linux-clk; +Cc: git-dev, Michal Simek



> -----Original Message-----
> From: Stephen Boyd <sboyd@kernel.org>
> Sent: Friday, September 10, 2021 2:43 AM
> To: Shubhrajyoti Datta <shubhraj@xilinx.com>; linux-clk@vger.kernel.org
> Cc: git-dev <git-dev@xilinx.com>; Michal Simek <michals@xilinx.com>
> Subject: Re: [PATCH] clk: zynqmp: Replaced strncpy() with strscpy()
> 
> Quoting Shubhrajyoti Datta (2021-09-07 02:09:20)
> > Replaced strncpy() with strscpy() as the clock names are supposed to
> 
> And what if they aren't?

That is taken care in 
https://www.spinics.net/lists/linux-clk/msg60505.html
where we are affixing null.
> 
> > be NULL terminated.
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-05 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  9:09 [PATCH] clk: zynqmp: Replaced strncpy() with strscpy() Shubhrajyoti Datta
2021-09-09 21:12 ` Stephen Boyd
2021-10-05 11:37   ` Shubhrajyoti Datta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.