Skip to content

Commit

Permalink
drivers/usb/gadget: using strlcpy instead of strncpy
Browse files Browse the repository at this point in the history
  for NUL terminated string, better notice '\0' in the end.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chen Gang authored and Greg Kroah-Hartman committed Feb 6, 2013
1 parent b11b2e1 commit 4d2079c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/gadget/f_uvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/string.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb/video.h>
Expand Down Expand Up @@ -419,7 +420,7 @@ uvc_register_video(struct uvc_device *uvc)
video->parent = &cdev->gadget->dev;
video->fops = &uvc_v4l2_fops;
video->release = video_device_release;
strncpy(video->name, cdev->gadget->name, sizeof(video->name));
strlcpy(video->name, cdev->gadget->name, sizeof(video->name));

uvc->vdev = video;
video_set_drvdata(video, uvc);
Expand Down

0 comments on commit 4d2079c

Please sign in to comment.