linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: math-emu: replace deprecated strcpy() in me-debugfs
@ 2025-09-01 13:39 Osama Abdelkader
  2025-09-02 11:55 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 3+ messages in thread
From: Osama Abdelkader @ 2025-09-01 13:39 UTC (permalink / raw)
  To: tsbogend; +Cc: linux-mips, linux-kernel, Osama Abdelkader

use strscpy() instead of deprecated strcpy().

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
---
 arch/mips/math-emu/me-debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index d5ad76b2bb67..94667cbe18e7 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name)
 {
 	int i = 0;
 
-	strcpy(out_name, in_name);
+	strscpy(out_name, in_name, sizeof(out_name));
 	while (in_name[i] != '\0') {
 		if (out_name[i] == '_')
 			out_name[i] = '.';
-- 
2.43.0


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

* Re: [PATCH] mips: math-emu: replace deprecated strcpy() in me-debugfs
  2025-09-01 13:39 [PATCH] mips: math-emu: replace deprecated strcpy() in me-debugfs Osama Abdelkader
@ 2025-09-02 11:55 ` Thomas Bogendoerfer
  2025-09-02 13:29   ` Osama Abdelkader
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Bogendoerfer @ 2025-09-02 11:55 UTC (permalink / raw)
  To: Osama Abdelkader; +Cc: linux-mips, linux-kernel

On Mon, Sep 01, 2025 at 03:39:19PM +0200, Osama Abdelkader wrote:
> use strscpy() instead of deprecated strcpy().
> 
> Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> ---
>  arch/mips/math-emu/me-debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
> index d5ad76b2bb67..94667cbe18e7 100644
> --- a/arch/mips/math-emu/me-debugfs.c
> +++ b/arch/mips/math-emu/me-debugfs.c
> @@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name)
>  {
>  	int i = 0;
>  
> -	strcpy(out_name, in_name);
> +	strscpy(out_name, in_name, sizeof(out_name));

this is wrong. sizeof(out_name) is the size of the pointer, but not the
size of the storage behind it. To be able to use strscpy() here you
need to pass in the size of the given buffer and use that.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

* Re: [PATCH] mips: math-emu: replace deprecated strcpy() in me-debugfs
  2025-09-02 11:55 ` Thomas Bogendoerfer
@ 2025-09-02 13:29   ` Osama Abdelkader
  0 siblings, 0 replies; 3+ messages in thread
From: Osama Abdelkader @ 2025-09-02 13:29 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips, linux-kernel

On Tue, Sep 02, 2025 at 01:55:47PM +0200, Thomas Bogendoerfer wrote:
> On Mon, Sep 01, 2025 at 03:39:19PM +0200, Osama Abdelkader wrote:
> > use strscpy() instead of deprecated strcpy().
> > 
> > Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
> > ---
> >  arch/mips/math-emu/me-debugfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
> > index d5ad76b2bb67..94667cbe18e7 100644
> > --- a/arch/mips/math-emu/me-debugfs.c
> > +++ b/arch/mips/math-emu/me-debugfs.c
> > @@ -41,7 +41,7 @@ static void adjust_instruction_counter_name(char *out_name, char *in_name)
> >  {
> >  	int i = 0;
> >  
> > -	strcpy(out_name, in_name);
> > +	strscpy(out_name, in_name, sizeof(out_name));
> 
> this is wrong. sizeof(out_name) is the size of the pointer, but not the
> size of the storage behind it. To be able to use strscpy() here you
> need to pass in the size of the given buffer and use that.
> 
> Thomas.
> 

Thanks Thomas, I just sent v2.

Regards,
Osama

> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2025-09-02 13:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01 13:39 [PATCH] mips: math-emu: replace deprecated strcpy() in me-debugfs Osama Abdelkader
2025-09-02 11:55 ` Thomas Bogendoerfer
2025-09-02 13:29   ` Osama Abdelkader

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).