diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-02-02 02:57:53 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-06 14:38:13 -0500 |
commit | b11b2e1bdd18ba5cd0dde075d440b3894e6ce64f (patch) | |
tree | 4cc9020f9f5800113d59246d12b79900cf937eb9 /drivers/usb | |
parent | 2f0760774711c957c395b31131b848043af98edf (diff) |
drivers/usb/core: using strlcpy instead of strncpy
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/devio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index b78fbe222b72..4a863fdbdccd 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/signal.h> | 40 | #include <linux/signal.h> |
41 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
42 | #include <linux/module.h> | 42 | #include <linux/module.h> |
43 | #include <linux/string.h> | ||
43 | #include <linux/usb.h> | 44 | #include <linux/usb.h> |
44 | #include <linux/usbdevice_fs.h> | 45 | #include <linux/usbdevice_fs.h> |
45 | #include <linux/usb/hcd.h> /* for usbcore internals */ | 46 | #include <linux/usb/hcd.h> /* for usbcore internals */ |
@@ -1077,7 +1078,7 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg) | |||
1077 | if (!intf || !intf->dev.driver) | 1078 | if (!intf || !intf->dev.driver) |
1078 | ret = -ENODATA; | 1079 | ret = -ENODATA; |
1079 | else { | 1080 | else { |
1080 | strncpy(gd.driver, intf->dev.driver->name, | 1081 | strlcpy(gd.driver, intf->dev.driver->name, |
1081 | sizeof(gd.driver)); | 1082 | sizeof(gd.driver)); |
1082 | ret = (copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0); | 1083 | ret = (copy_to_user(arg, &gd, sizeof(gd)) ? -EFAULT : 0); |
1083 | } | 1084 | } |