datapath: Fix argument to strncpy_from_user().
authorBen Pfaff <blp@nicira.com>
Tue, 27 Apr 2010 17:21:12 +0000 (10:21 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 27 Apr 2010 17:21:12 +0000 (10:21 -0700)
The strncpy_from_user() function's 'count' argument is documented to
include the trailing null byte, but create_dp() did not include it.  This
commit adds it in.

datapath/datapath.c

index e1320f2..be16044 100644 (file)
@@ -203,7 +203,7 @@ static int create_dp(int dp_idx, const char __user *devnamep)
 
        if (devnamep) {
                err = -EFAULT;
-               if (strncpy_from_user(devname, devnamep, IFNAMSIZ - 1) < 0)
+               if (strncpy_from_user(devname, devnamep, IFNAMSIZ) < 0)
                        goto err;
                devname[IFNAMSIZ - 1] = '\0';
        } else {