[PATCH] md: md.c: use strlcpy instead of strcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Name of major driver can be of maximum of DISK_NAME_LEN size, therefore
use strlcpy instead of strcpy.

Signed-off-by: Kumar Amit Mehta <gmate.amit@xxxxxxxxx>
---
 drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0bbe710..9450a2c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4863,7 +4863,7 @@ static int md_alloc(dev_t dev, char *name)
 	disk->major = MAJOR(mddev->unit);
 	disk->first_minor = unit << shift;
 	if (name)
-		strcpy(disk->disk_name, name);
+		strlcpy(disk->disk_name, name, DISK_NAME_LEN);
 	else if (partitioned)
 		sprintf(disk->disk_name, "md_d%d", unit);
 	else
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux