]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: most: core: replace strcpy() by strscpy()
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 22 Apr 2019 15:40:38 +0000 (10:40 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Apr 2019 10:04:48 +0000 (12:04 +0200)
The strcpy() function is being deprecated. Replace it by the safer
strscpy() and fix the following Coverity warning:

"You might overrun the 80-character fixed-size string iface->p->name
by copying iface->description without checking the length."

Addresses-Coverity-ID: 1444760 ("Copy into fixed size buffer")
Fixes: 131ac62253db ("staging: most: core: use device description as name")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/core.c

index b1f7f707cacd2141acde3e039a14d07bd4d6825e..86a8545c8d9740734ec3f15f89b2a66148792481 100644 (file)
@@ -1397,7 +1397,7 @@ int most_register_interface(struct most_interface *iface)
 
        INIT_LIST_HEAD(&iface->p->channel_list);
        iface->p->dev_id = id;
-       strcpy(iface->p->name, iface->description);
+       strscpy(iface->p->name, iface->description, sizeof(iface->p->name));
        iface->dev.init_name = iface->p->name;
        iface->dev.bus = &mc.bus;
        iface->dev.parent = &mc.dev;