* [PATCH] usb: replace strcpy() with strscpy()
@ 2025-02-28 15:07 Aditya Garg
2025-02-28 17:02 ` gregkh
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Aditya Garg @ 2025-02-28 15:07 UTC (permalink / raw)
To: castet.matthieu@free.fr, stf_xl@wp.pl, gregkh@linuxfoundation.org,
b-liu@ti.com, johan@kernel.org, heikki.krogerus@linux.intel.com,
valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org
From: Aditya Garg <gargaditya08@live.com>
The strcpy() function has been deprecated and replaced with strscpy().
This patch shall replace it in the whole USB tree.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
drivers/usb/atm/ueagle-atm.c | 2 +-
drivers/usb/gadget/configfs.c | 2 +-
drivers/usb/gadget/function/f_midi2.c | 6 +++---
drivers/usb/gadget/function/u_serial.c | 2 +-
drivers/usb/gadget/udc/fsl_qe_udc.c | 2 +-
drivers/usb/gadget/udc/fsl_udc_core.c | 2 +-
drivers/usb/gadget/udc/snps_udc_core.c | 2 +-
drivers/usb/musb/musb_core.c | 2 +-
drivers/usb/serial/ti_usb_3410_5052.c | 16 ++++++++--------
drivers/usb/typec/tcpm/tcpm.c | 6 +++---
drivers/usb/usbip/vhci_sysfs.c | 2 +-
11 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index cd0f7b4bd..04f114d0f 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1571,7 +1571,7 @@ static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
} else
file = cmv_file[sc->modem_index];
- strcpy(cmv_name, FW_DIR);
+ strscpy(cmv_name, FW_DIR);
strlcat(cmv_name, file, UEA_FW_NAME_MAX);
if (ver == 2)
strlcat(cmv_name, ".v2", UEA_FW_NAME_MAX);
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index fba2a56da..0c80a4011 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -129,7 +129,7 @@ static int usb_string_copy(const char *s, char **s_copy)
if (!str)
return -ENOMEM;
}
- strcpy(str, s);
+ strscpy(str, s);
if (str[ret - 1] == '\n')
str[ret - 1] = '\0';
*s_copy = str;
diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c
index 12e866fb3..72d034e78 100644
--- a/drivers/usb/gadget/function/f_midi2.c
+++ b/drivers/usb/gadget/function/f_midi2.c
@@ -1542,9 +1542,9 @@ static int f_midi2_create_card(struct f_midi2 *midi2)
return err;
midi2->card = card;
- strcpy(card->driver, "f_midi2");
- strcpy(card->shortname, "MIDI 2.0 Gadget");
- strcpy(card->longname, "MIDI 2.0 Gadget");
+ strscpy(card->driver, "f_midi2");
+ strscpy(card->shortname, "MIDI 2.0 Gadget");
+ strscpy(card->longname, "MIDI 2.0 Gadget");
id = 0;
for (i = 0; i < midi2->num_eps; i++) {
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index 36fff45e8..053b1f2a0 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1054,7 +1054,7 @@ static int gs_console_init(struct gs_port *port)
if (!cons)
return -ENOMEM;
- strcpy(cons->console.name, "ttyGS");
+ strscpy(cons->console.name, "ttyGS");
cons->console.write = gs_console_write;
cons->console.device = gs_console_device;
cons->console.flags = CON_PRINTBUFFER;
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index aacfde063..b12d2441c 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -2410,7 +2410,7 @@ static int qe_ep_config(struct qe_udc *udc, unsigned char pipe_num)
struct qe_ep *ep = &udc->eps[pipe_num];
ep->udc = udc;
- strcpy(ep->name, ep_name[pipe_num]);
+ strscpy(ep->name, ep_name[pipe_num]);
ep->ep.name = ep_name[pipe_num];
if (pipe_num == 0) {
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 4dea8bc30..eb64aa96c 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2321,7 +2321,7 @@ static int struct_ep_setup(struct fsl_udc *udc, unsigned char index,
struct fsl_ep *ep = &udc->eps[index];
ep->udc = udc;
- strcpy(ep->name, name);
+ strscpy(ep->name, name);
ep->ep.name = ep->name;
ep->ep.ops = &fsl_ep_ops;
diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/gadget/udc/snps_udc_core.c
index 1f8a99d2a..ad12b5c16 100644
--- a/drivers/usb/gadget/udc/snps_udc_core.c
+++ b/drivers/usb/gadget/udc/snps_udc_core.c
@@ -3151,7 +3151,7 @@ int udc_probe(struct udc *dev)
tmp, dev->phys_addr, dev->chiprev,
(dev->chiprev == UDC_HSA0_REV) ?
"A0" : "B1");
- strcpy(tmp, UDC_DRIVER_VERSION_STRING);
+ strscpy(tmp, UDC_DRIVER_VERSION_STRING);
if (dev->chiprev == UDC_HSA0_REV) {
dev_err(dev->dev, "chip revision is A0; too old\n");
retval = -ENODEV;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 7f349f5e7..b3a943eca 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1600,7 +1600,7 @@ static int musb_core_init(u16 musb_type, struct musb *musb)
/* log core options (read using indexed model) */
reg = musb_read_configdata(mbase);
- strcpy(aInfo, (reg & MUSB_CONFIGDATA_UTMIDW) ? "UTMI-16" : "UTMI-8");
+ strscpy(aInfo, (reg & MUSB_CONFIGDATA_UTMIDW) ? "UTMI-16" : "UTMI-8");
if (reg & MUSB_CONFIGDATA_DYNFIFO) {
strcat(aInfo, ", dyn FIFOs");
musb->dyn_fifo = true;
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index a0c244bc7..50d76205b 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1605,29 +1605,29 @@ static int ti_download_firmware(struct ti_device *tdev)
if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) {
switch (le16_to_cpu(dev->descriptor.idProduct)) {
case MTS_CDMA_PRODUCT_ID:
- strcpy(buf, "mts_cdma.fw");
+ strscpy(buf, "mts_cdma.fw");
break;
case MTS_GSM_PRODUCT_ID:
- strcpy(buf, "mts_gsm.fw");
+ strscpy(buf, "mts_gsm.fw");
break;
case MTS_EDGE_PRODUCT_ID:
- strcpy(buf, "mts_edge.fw");
+ strscpy(buf, "mts_edge.fw");
break;
case MTS_MT9234MU_PRODUCT_ID:
- strcpy(buf, "mts_mt9234mu.fw");
+ strscpy(buf, "mts_mt9234mu.fw");
break;
case MTS_MT9234ZBA_PRODUCT_ID:
- strcpy(buf, "mts_mt9234zba.fw");
+ strscpy(buf, "mts_mt9234zba.fw");
break;
case MTS_MT9234ZBAOLD_PRODUCT_ID:
- strcpy(buf, "mts_mt9234zba.fw");
+ strscpy(buf, "mts_mt9234zba.fw");
break; }
}
if (buf[0] == '\0') {
if (tdev->td_is_3410)
- strcpy(buf, "ti_3410.fw");
+ strscpy(buf, "ti_3410.fw");
else
- strcpy(buf, "ti_5052.fw");
+ strscpy(buf, "ti_5052.fw");
}
status = request_firmware(&fw_p, buf, &dev->dev);
}
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 6bf1a22c7..461240086 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -710,7 +710,7 @@ static void _tcpm_log(struct tcpm_port *port, const char *fmt, va_list args)
if (tcpm_log_full(port)) {
port->logbuffer_head = max(port->logbuffer_head - 1, 0);
- strcpy(tmpbuffer, "overflow");
+ strscpy(tmpbuffer, "overflow");
}
if (port->logbuffer_head < 0 ||
@@ -813,10 +813,10 @@ static void tcpm_log_source_caps(struct tcpm_port *port)
pdo_pps_apdo_max_voltage(pdo),
pdo_pps_apdo_max_current(pdo));
else
- strcpy(msg, "undefined APDO");
+ strscpy(msg, "undefined APDO");
break;
default:
- strcpy(msg, "undefined");
+ strscpy(msg, "undefined");
break;
}
tcpm_log(port, " PDO %d: type %d, %s",
diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
index d5865460e..4d6be26db 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.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: replace strcpy() with strscpy()
2025-02-28 15:07 [PATCH] usb: replace strcpy() with strscpy() Aditya Garg
@ 2025-02-28 17:02 ` gregkh
2025-02-28 17:09 ` Aditya Garg
2025-03-01 18:49 ` kernel test robot
2025-03-01 19:33 ` kernel test robot
2 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2025-02-28 17:02 UTC (permalink / raw)
To: Aditya Garg
Cc: castet.matthieu@free.fr, stf_xl@wp.pl, b-liu@ti.com,
johan@kernel.org, heikki.krogerus@linux.intel.com,
valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org
On Fri, Feb 28, 2025 at 03:07:03PM +0000, Aditya Garg wrote:
> From: Aditya Garg <gargaditya08@live.com>
>
> The strcpy() function has been deprecated and replaced with strscpy().
> This patch shall replace it in the whole USB tree.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
As the two functions do different things, are you sure it is safe to
just do a search/replace here? If so, you need to explain that in the
changelog why this is ok, and if not, please document that as well :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: replace strcpy() with strscpy()
2025-02-28 17:02 ` gregkh
@ 2025-02-28 17:09 ` Aditya Garg
0 siblings, 0 replies; 5+ messages in thread
From: Aditya Garg @ 2025-02-28 17:09 UTC (permalink / raw)
To: gregkh@linuxfoundation.org
Cc: castet.matthieu@free.fr, stf_xl@wp.pl, b-liu@ti.com,
johan@kernel.org, heikki.krogerus@linux.intel.com,
valentina.manea.m@gmail.com, shuah@kernel.org, i@zenithal.me,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org
> On 28 Feb 2025, at 10:33 PM, gregkh@linuxfoundation.org wrote:
>
> On Fri, Feb 28, 2025 at 03:07:03PM +0000, Aditya Garg wrote:
>> From: Aditya Garg <gargaditya08@live.com>
>>
>> The strcpy() function has been deprecated and replaced with strscpy().
>> This patch shall replace it in the whole USB tree.
>>
>> Link: https://github.com/KSPP/linux/issues/88
>> Signed-off-by: Aditya Garg <gargaditya08@live.com>
>
> As the two functions do different things, are you sure it is safe to
> just do a search/replace here? If so, you need to explain that in the
> changelog why this is ok, and if not, please document that as well :)
That's actually a good question. From what I can tell from the kernel docs, the only case where this can be a problem is when strcpy is returning. While I don't see any such case over here, I'll still double check if that's the case. Also, I'll wait for the kernel test bot results.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: replace strcpy() with strscpy()
2025-02-28 15:07 [PATCH] usb: replace strcpy() with strscpy() Aditya Garg
2025-02-28 17:02 ` gregkh
@ 2025-03-01 18:49 ` kernel test robot
2025-03-01 19:33 ` kernel test robot
2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-03-01 18:49 UTC (permalink / raw)
To: Aditya Garg, castet.matthieu@free.fr, stf_xl@wp.pl,
gregkh@linuxfoundation.org, b-liu@ti.com, johan@kernel.org,
heikki.krogerus@linux.intel.com, valentina.manea.m@gmail.com,
shuah@kernel.org, i@zenithal.me
Cc: oe-kbuild-all, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Hi Aditya,
kernel test robot noticed the following build errors:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus johan-usb-serial/usb-next johan-usb-serial/usb-linus linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Aditya-Garg/usb-replace-strcpy-with-strscpy/20250228-230839
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/DEF7EF73-12C4-4F30-BC14-DD829F0C6884%40live.com
patch subject: [PATCH] usb: replace strcpy() with strscpy()
config: csky-randconfig-002-20250302 (https://download.01.org/0day-ci/archive/20250302/202503020226.3yStuXZ8-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020226.3yStuXZ8-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020226.3yStuXZ8-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/module.h:12,
from drivers/usb/atm/ueagle-atm.c:15:
drivers/usb/atm/ueagle-atm.c: In function 'cmvs_file_name':
>> include/linux/compiler.h:197:62: error: static assertion failed: "must be array"
197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^~~~~~~~~~~~~~
include/linux/compiler.h:202:33: note: in expansion of macro '__BUILD_BUG_ON_ZERO_MSG'
202 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/string.h:80:47: note: in expansion of macro '__must_be_array'
80 | sized_strscpy(dst, src, sizeof(dst) + __must_be_array(dst) + \
| ^~~~~~~~~~~~~~~
include/linux/args.h:25:24: note: in expansion of macro '__strscpy0'
25 | #define __CONCAT(a, b) a ## b
| ^
include/linux/args.h:26:27: note: in expansion of macro '__CONCAT'
26 | #define CONCATENATE(a, b) __CONCAT(a, b)
| ^~~~~~~~
include/linux/string.h:114:9: note: in expansion of macro 'CONCATENATE'
114 | CONCATENATE(__strscpy, COUNT_ARGS(__VA_ARGS__))(dst, src, __VA_ARGS__)
| ^~~~~~~~~~~
drivers/usb/atm/ueagle-atm.c:1574:9: note: in expansion of macro 'strscpy'
1574 | strscpy(cmv_name, FW_DIR);
| ^~~~~~~
vim +197 include/linux/compiler.h
230fa253df6352 Christian Borntraeger 2014-11-25 193
cb7380de9e4cbc Kees Cook 2025-02-05 194 #ifdef __CHECKER__
cb7380de9e4cbc Kees Cook 2025-02-05 195 #define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
cb7380de9e4cbc Kees Cook 2025-02-05 196 #else /* __CHECKER__ */
cb7380de9e4cbc Kees Cook 2025-02-05 @197 #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
cb7380de9e4cbc Kees Cook 2025-02-05 198 #endif /* __CHECKER__ */
cb7380de9e4cbc Kees Cook 2025-02-05 199
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] usb: replace strcpy() with strscpy()
2025-02-28 15:07 [PATCH] usb: replace strcpy() with strscpy() Aditya Garg
2025-02-28 17:02 ` gregkh
2025-03-01 18:49 ` kernel test robot
@ 2025-03-01 19:33 ` kernel test robot
2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-03-01 19:33 UTC (permalink / raw)
To: Aditya Garg, castet.matthieu@free.fr, stf_xl@wp.pl,
gregkh@linuxfoundation.org, b-liu@ti.com, johan@kernel.org,
heikki.krogerus@linux.intel.com, valentina.manea.m@gmail.com,
shuah@kernel.org, i@zenithal.me
Cc: llvm, oe-kbuild-all, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Hi Aditya,
kernel test robot noticed the following build errors:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus johan-usb-serial/usb-next johan-usb-serial/usb-linus linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Aditya-Garg/usb-replace-strcpy-with-strscpy/20250228-230839
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/DEF7EF73-12C4-4F30-BC14-DD829F0C6884%40live.com
patch subject: [PATCH] usb: replace strcpy() with strscpy()
config: arm-qcom_defconfig (https://download.01.org/0day-ci/archive/20250302/202503020319.Lj7EYfWc-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020319.Lj7EYfWc-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020319.Lj7EYfWc-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/usb/gadget/configfs.c:132:2: error: static assertion failed due to requirement '!(!(!__builtin_types_compatible_p(char *, char *)))': must be array
132 | strscpy(str, s);
| ^~~~~~~~~~~~~~~
include/linux/string.h:114:2: note: expanded from macro 'strscpy'
114 | CONCATENATE(__strscpy, COUNT_ARGS(__VA_ARGS__))(dst, src, __VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/args.h:26:27: note: expanded from macro 'CONCATENATE'
26 | #define CONCATENATE(a, b) __CONCAT(a, b)
| ^
include/linux/args.h:25:24: note: expanded from macro '__CONCAT'
25 | #define __CONCAT(a, b) a ## b
| ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/string.h:80:40: note: expanded from macro '__strscpy0'
80 | sized_strscpy(dst, src, sizeof(dst) + __must_be_array(dst) + \
| ^~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:202:28: note: expanded from macro '__must_be_array'
202 | #define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
203 | "must be array")
| ~~~~~~~~~~~~~~~~
include/linux/compiler.h:197:77: note: expanded from macro '__BUILD_BUG_ON_ZERO_MSG'
197 | #define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
| ^~~~
1 error generated.
vim +132 drivers/usb/gadget/configfs.c
112
113 static int usb_string_copy(const char *s, char **s_copy)
114 {
115 int ret;
116 char *str;
117 char *copy = *s_copy;
118
119 ret = strlen(s);
120 if (ret > USB_MAX_STRING_LEN)
121 return -EOVERFLOW;
122 if (ret < 1)
123 return -EINVAL;
124
125 if (copy) {
126 str = copy;
127 } else {
128 str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL);
129 if (!str)
130 return -ENOMEM;
131 }
> 132 strscpy(str, s);
133 if (str[ret - 1] == '\n')
134 str[ret - 1] = '\0';
135 *s_copy = str;
136 return 0;
137 }
138
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-01 19:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 15:07 [PATCH] usb: replace strcpy() with strscpy() Aditya Garg
2025-02-28 17:02 ` gregkh
2025-02-28 17:09 ` Aditya Garg
2025-03-01 18:49 ` kernel test robot
2025-03-01 19:33 ` kernel test robot
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).