[PATCH] Drivers: Staging: cxt1e1: strncpy issue, need set zero at the end.

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

 



  need set '\0' at the end. or cause issue.

    it is called by c4_ioctl in drivers/staging/cxt1e1/linux.c
    all things need be initialized, before provide them to user mode.
    so we can not use strlcpy instead of strncpy.

  code style:
    all contents of the file use 4 spaces instead of '\t',
    so this patch has to follow, now.

Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
---
 drivers/staging/cxt1e1/pmcc4_drv.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/cxt1e1/pmcc4_drv.c b/drivers/staging/cxt1e1/pmcc4_drv.c
index 8a7b3a6..8d8a22b 100644
--- a/drivers/staging/cxt1e1/pmcc4_drv.c
+++ b/drivers/staging/cxt1e1/pmcc4_drv.c
@@ -1545,6 +1545,7 @@ c4_get_iidinfo (ci_t * ci, struct sbe_iid_info * iip)
 
     np = dev->name;
     strncpy (iip->iname, np, CHNM_STRLEN - 1);
+    iip->iname[CHNM_STRLEN - 1] = '\0';
     return 0;
 }
 
-- 
1.7.7.6
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux