public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
  2026-03-10  9:44 [PATCH 0/6] " Ai Chao
@ 2026-03-10  9:44 ` Ai Chao
  2026-03-10 22:10   ` Shuah Khan
  0 siblings, 1 reply; 7+ messages in thread
From: Ai Chao @ 2026-03-10  9:44 UTC (permalink / raw)
  To: gregkh, b-liu, johan, badhri, heikki.krogerus, valentina.manea.m,
	shuah, i, tiwai, kees, christophe.jaillet, prashanth.k, khtsai,
	dan.carpenter, tglx, mingo
  Cc: linux-usb, linux-kernel, Ai Chao

Use a safer function strscpy() instead of strcpy() for copying to
arrays.

Only idiomatic code replacement, and no functional changes.

Signed-off-by: Ai Chao <aichao@kylinos.cn>
---
 drivers/usb/usbip/vhci_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
index bfc10f665e52..5bc8c47788d4 100644
--- a/drivers/usb/usbip/vhci_sysfs.c
+++ b/drivers/usb/usbip/vhci_sysfs.c
@@ -463,7 +463,7 @@ static void set_status_attr(int id)
 
 	status = status_attrs + id;
 	if (id == 0)
-		strcpy(status->name, "status");
+		strscpy(status->name, "status");
 	else
 		snprintf(status->name, MAX_STATUS_NAME+1, "status.%d", id);
 	status->attr.attr.name = status->name;
-- 
2.34.1


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

* Re: [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
  2026-03-10  9:44 ` [PATCH 6/6] usbip: vhci_sysfs: " Ai Chao
@ 2026-03-10 22:10   ` Shuah Khan
  2026-03-11  7:22     ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2026-03-10 22:10 UTC (permalink / raw)
  To: Ai Chao, gregkh, b-liu, johan, badhri, heikki.krogerus,
	valentina.manea.m, shuah, i, tiwai, kees, christophe.jaillet,
	prashanth.k, khtsai, dan.carpenter, tglx, mingo
  Cc: linux-usb, linux-kernel, Shuah Khan

On 3/10/26 03:44, Ai Chao wrote:
> Use a safer function strscpy() instead of strcpy() for copying to
> arrays.
> 
> Only idiomatic code replacement, and no functional changes.

It is a functional change since it calls a new routine. Get rid
of this line from change log.

How did you test this patch? I am curious because of you are
describing the change as "idiomatic code replacement"

> 
> Signed-off-by: Ai Chao <aichao@kylinos.cn>
> ---
>   drivers/usb/usbip/vhci_sysfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
> index bfc10f665e52..5bc8c47788d4 100644
> --- a/drivers/usb/usbip/vhci_sysfs.c
> +++ b/drivers/usb/usbip/vhci_sysfs.c
> @@ -463,7 +463,7 @@ static void set_status_attr(int id)
>   
>   	status = status_attrs + id;
>   	if (id == 0)
> -		strcpy(status->name, "status");
> +		strscpy(status->name, "status");
>   	else
>   		snprintf(status->name, MAX_STATUS_NAME+1, "status.%d", id);
>   	status->attr.attr.name = status->name;

thanks,
-- Shuah


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

* Re: [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
  2026-03-10 22:10   ` Shuah Khan
@ 2026-03-11  7:22     ` Dan Carpenter
  2026-03-24 21:34       ` Shuah Khan
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2026-03-11  7:22 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Ai Chao, gregkh, b-liu, johan, badhri, heikki.krogerus,
	valentina.manea.m, shuah, i, tiwai, kees, christophe.jaillet,
	prashanth.k, khtsai, tglx, mingo, linux-usb, linux-kernel

On Tue, Mar 10, 2026 at 04:10:20PM -0600, Shuah Khan wrote:
> On 3/10/26 03:44, Ai Chao wrote:
> > Use a safer function strscpy() instead of strcpy() for copying to
> > arrays.
> > 
> > Only idiomatic code replacement, and no functional changes.
> 
> It is a functional change since it calls a new routine. Get rid
> of this line from change log.
> 
> How did you test this patch? I am curious because of you are
> describing the change as "idiomatic code replacement"
> 

I liked the commit message...  To me it says that patch affect
runtime.  It doesn' fix any bugs or introduce any bugs.  Too often
these changes are sold as a "potential" bugfix, which means people
haven't bothered to check whether it fixes a bug or not.

It's the right thing to add a note under the --- cut off that the
patch hasn't been tested.  Testing isn't required for this sort
of patch but a note is good so reviewers will know to be careful.

regards,
dan carpenter


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

* Re: [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
  2026-03-11  7:22     ` Dan Carpenter
@ 2026-03-24 21:34       ` Shuah Khan
  2026-03-25 11:09         ` Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2026-03-24 21:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ai Chao, gregkh, b-liu, johan, badhri, heikki.krogerus,
	valentina.manea.m, shuah, i, tiwai, kees, christophe.jaillet,
	prashanth.k, khtsai, tglx, mingo, linux-usb, linux-kernel,
	Shuah Khan

On 3/11/26 01:22, Dan Carpenter wrote:
> On Tue, Mar 10, 2026 at 04:10:20PM -0600, Shuah Khan wrote:
>> On 3/10/26 03:44, Ai Chao wrote:
>>> Use a safer function strscpy() instead of strcpy() for copying to
>>> arrays.
>>>
>>> Only idiomatic code replacement, and no functional changes.
>>
>> It is a functional change since it calls a new routine. Get rid
>> of this line from change log.
>>
>> How did you test this patch? I am curious because of you are
>> describing the change as "idiomatic code replacement"
>>
> 
> I liked the commit message...  To me it says that patch affect
> runtime.  It doesn' fix any bugs or introduce any bugs.  Too often
> these changes are sold as a "potential" bugfix, which means people
> haven't bothered to check whether it fixes a bug or not.
> 
> It's the right thing to add a note under the --- cut off that the
> patch hasn't been tested.  Testing isn't required for this sort
> of patch but a note is good so reviewers will know to be careful.

I would like to see some sort of testing for patches like this one.
It isn't hard to test this change.

thanks,
-- Shuah

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

* Re: [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
  2026-03-24 21:34       ` Shuah Khan
@ 2026-03-25 11:09         ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2026-03-25 11:09 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Ai Chao, gregkh, b-liu, johan, badhri, heikki.krogerus,
	valentina.manea.m, shuah, i, tiwai, kees, christophe.jaillet,
	prashanth.k, khtsai, tglx, mingo, linux-usb, linux-kernel

On Tue, Mar 24, 2026 at 03:34:03PM -0600, Shuah Khan wrote:
> On 3/11/26 01:22, Dan Carpenter wrote:
> > On Tue, Mar 10, 2026 at 04:10:20PM -0600, Shuah Khan wrote:
> > > On 3/10/26 03:44, Ai Chao wrote:
> > > > Use a safer function strscpy() instead of strcpy() for copying to
> > > > arrays.
> > > > 
> > > > Only idiomatic code replacement, and no functional changes.
> > > 
> > > It is a functional change since it calls a new routine. Get rid
> > > of this line from change log.
> > > 
> > > How did you test this patch? I am curious because of you are
> > > describing the change as "idiomatic code replacement"
> > > 
> > 
> > I liked the commit message...  To me it says that patch affect
> > runtime.  It doesn' fix any bugs or introduce any bugs.  Too often
> > these changes are sold as a "potential" bugfix, which means people
> > haven't bothered to check whether it fixes a bug or not.
> > 
> > It's the right thing to add a note under the --- cut off that the
> > patch hasn't been tested.  Testing isn't required for this sort
> > of patch but a note is good so reviewers will know to be careful.
> 
> I would like to see some sort of testing for patches like this one.
> It isn't hard to test this change.

It would take me a while to figure out how to test this. :P Presumably,
it's:

sudo ./tools/testing/selftests/drivers/usb/usbip/usbip_test.sh -b<busid> -p tools/usb/usbip/

but I couldn't figure out what to supply for a busid...  Does
kernel-ci do usbip testing?

regards,
dan carpenter

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

* Re: [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
       [not found] <7990xi1aonqb-79968wxve9t0@nsmail8.2--kylin--1>
@ 2026-03-26 18:19 ` Shuah Khan
  2026-03-30 14:49   ` gregkh
  0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2026-03-26 18:19 UTC (permalink / raw)
  To: 艾超, gregkh
  Cc: b-liu, johan, badhri, heikki.krogerus, valentina.manea.m, shuah,
	i, tiwai, kees, christophe.jaillet, prashanth.k, khtsai, tglx,
	mingo, linux-usb, linux-kernel, Shuah Khan, Dan Carpenter

On 3/25/26 04:57, 艾超 wrote:
> Dear Shuah:
> 
> Test Report for [usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()]
> Environment:
> Kernel Version: v6.12.76+ (with patch applied)
> Hardware/QEMU: Thinkpad E15


> Conclusion:
> The longth of the name is MAX_STATUS_NAME+1 = 17, used the strcpy copy "status-abcdefghijklmnopqrstuvwxyz1234567890" in name and used strscpy copy "status-abcdefghi" in name.
> Tested-by: Aichao@kylinos.cn
> 

Thank you for the report.

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

Greg, Please pick this patch up.

thanks,
-- Shuah

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

* Re: [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()
  2026-03-26 18:19 ` [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy() Shuah Khan
@ 2026-03-30 14:49   ` gregkh
  0 siblings, 0 replies; 7+ messages in thread
From: gregkh @ 2026-03-30 14:49 UTC (permalink / raw)
  To: Shuah Khan
  Cc: 艾超, b-liu, johan, badhri, heikki.krogerus,
	valentina.manea.m, shuah, i, tiwai, kees, christophe.jaillet,
	prashanth.k, khtsai, tglx, mingo, linux-usb, linux-kernel,
	Dan Carpenter

On Thu, Mar 26, 2026 at 12:19:24PM -0600, Shuah Khan wrote:
> On 3/25/26 04:57, 艾超 wrote:
> > Dear Shuah:
> > 
> > Test Report for [usbip: vhci_sysfs: Use safer strscpy() instead of strcpy()]
> > Environment:
> > Kernel Version: v6.12.76+ (with patch applied)
> > Hardware/QEMU: Thinkpad E15
> 
> 
> > Conclusion:
> > The longth of the name is MAX_STATUS_NAME+1 = 17, used the strcpy copy "status-abcdefghijklmnopqrstuvwxyz1234567890" in name and used strscpy copy "status-abcdefghi" in name.
> > Tested-by: Aichao@kylinos.cn
> > 
> 
> Thank you for the report.
> 
> Acked-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> Greg, Please pick this patch up.

Can someone resend it please, I can't seem to find it anywhere on its
own.

thanks,

greg k-h

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

end of thread, other threads:[~2026-03-30 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7990xi1aonqb-79968wxve9t0@nsmail8.2--kylin--1>
2026-03-26 18:19 ` [PATCH 6/6] usbip: vhci_sysfs: Use safer strscpy() instead of strcpy() Shuah Khan
2026-03-30 14:49   ` gregkh
2026-03-10  9:44 [PATCH 0/6] " Ai Chao
2026-03-10  9:44 ` [PATCH 6/6] usbip: vhci_sysfs: " Ai Chao
2026-03-10 22:10   ` Shuah Khan
2026-03-11  7:22     ` Dan Carpenter
2026-03-24 21:34       ` Shuah Khan
2026-03-25 11:09         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox