]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
EDP: fix string handling in consumer_unregister
authorTimo Alho <talho@nvidia.com>
Fri, 13 Dec 2013 06:27:53 +0000 (08:27 +0200)
committerJuha Tukkinen <jtukkinen@nvidia.com>
Tue, 17 Dec 2013 12:20:17 +0000 (04:20 -0800)
Last character of incoming string was mistakenly stripped. This patch
fixes the issue.

Bug 1416849

Change-Id: I8741504bb5887ad54b93a5066a99bfecc55cff9f
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: http://git-master/r/345196
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Greg Heinrich <gheinrich@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
drivers/edp/sysedp_sysfs.c

index f471043d28fbc425bd5978e0eece9070d0bcdcfa..a3f80c3ca3c1a1b508531fbe4c7ea0062b300dfe 100644 (file)
@@ -296,9 +296,9 @@ static ssize_t consumer_unregister_store(const char *s, size_t count)
        size_t n;
        struct sysedp_consumer *consumer;
 
-       n = count > SYSEDP_NAME_LEN ? SYSEDP_NAME_LEN : count;
+       n = count > SYSEDP_NAME_LEN - 1 ? SYSEDP_NAME_LEN - 1 : count;
        strncpy(name, s, n);
-       name[n-1] = 0;
+       name[n] = 0;
        consumer = sysedp_get_consumer(strim(name));
 
        if (!consumer)