[PATCH] drivers/staging/media/go7007: using strlcpy instead of strncpy

2013-03-24 Thread Chen Gang

  for NUL terminated string, need always set '\0' in the end.

Signed-off-by: Chen Gang gang.c...@asianux.com
---
 drivers/staging/media/go7007/saa7134-go7007.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/media/go7007/saa7134-go7007.c 
b/drivers/staging/media/go7007/saa7134-go7007.c
index cf7c34a..2d1c6c2 100644
--- a/drivers/staging/media/go7007/saa7134-go7007.c
+++ b/drivers/staging/media/go7007/saa7134-go7007.c
@@ -456,7 +456,7 @@ static int saa7134_go7007_init(struct saa7134_dev *dev)
if (go == NULL)
goto allocfail;
go-board_id = GO7007_BOARDID_PCI_VOYAGER;
-   strncpy(go-name, saa7134_boards[dev-board].name, sizeof(go-name));
+   strlcpy(go-name, saa7134_boards[dev-board].name, sizeof(go-name));
go-hpi_ops = saa7134_go7007_hpi_ops;
go-hpi_context = saa;
saa-dev = dev;
-- 
1.7.7.6
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drivers/staging/media/go7007: using strlcpy instead of strncpy

2013-03-19 Thread Chen Gang

  for NUL terminated string, need always set '\0' in the end.

Signed-off-by: Chen Gang gang.c...@asianux.com
---
 drivers/staging/media/go7007/snd-go7007.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/go7007/snd-go7007.c 
b/drivers/staging/media/go7007/snd-go7007.c
index 5af29ff..6f6271e 100644
--- a/drivers/staging/media/go7007/snd-go7007.c
+++ b/drivers/staging/media/go7007/snd-go7007.c
@@ -267,9 +267,9 @@ int go7007_snd_init(struct go7007 *go)
kfree(gosnd);
return ret;
}
-   strncpy(gosnd-card-driver, go7007, sizeof(gosnd-card-driver));
-   strncpy(gosnd-card-shortname, go-name, sizeof(gosnd-card-driver));
-   strncpy(gosnd-card-longname, gosnd-card-shortname,
+   strlcpy(gosnd-card-driver, go7007, sizeof(gosnd-card-driver));
+   strlcpy(gosnd-card-shortname, go-name, sizeof(gosnd-card-driver));
+   strlcpy(gosnd-card-longname, gosnd-card-shortname,
sizeof(gosnd-card-longname));
 
gosnd-pcm-private_data = go;
-- 
1.7.7.6
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drivers/staging/media/go7007: using strlcpy instead of strncpy

2013-03-19 Thread Chen Gang

  better to treate them as NUL terminated string.

Signed-off-by: Chen Gang gang.c...@asianux.com
---
 drivers/staging/media/go7007/go7007-v4l2.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/go7007/go7007-v4l2.c 
b/drivers/staging/media/go7007/go7007-v4l2.c
index cb9fe33..9050e19 100644
--- a/drivers/staging/media/go7007/go7007-v4l2.c
+++ b/drivers/staging/media/go7007/go7007-v4l2.c
@@ -637,7 +637,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void  
*priv,
fmt-type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt-flags = V4L2_FMT_FLAG_COMPRESSED;
 
-   strncpy(fmt-description, desc, sizeof(fmt-description));
+   strlcpy(fmt-description, desc, sizeof(fmt-description));
 
return 0;
 }
@@ -1181,7 +1181,7 @@ static int vidioc_enum_input(struct file *file, void 
*priv,
if (inp-index = go-board_info-num_inputs)
return -EINVAL;
 
-   strncpy(inp-name, go-board_info-inputs[inp-index].name,
+   strlcpy(inp-name, go-board_info-inputs[inp-index].name,
sizeof(inp-name));
 
/* If this board has a tuner, it will be the last input */
-- 
1.7.7.6
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html