Commit a209bc78 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sysfs_create_link() fix

It is incorrectly precalculating the string's length.
parent d8475074
...@@ -80,7 +80,7 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * nam ...@@ -80,7 +80,7 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * nam
char * s; char * s;
depth = object_depth(kobj); depth = object_depth(kobj);
size = object_path_length(target) + depth * 3 - 1; size = object_path_length(target) + depth * 3 + 1;
if (size > PATH_MAX) if (size > PATH_MAX)
return -ENAMETOOLONG; return -ENAMETOOLONG;
pr_debug("%s: depth = %d, size = %d\n",__FUNCTION__,depth,size); pr_debug("%s: depth = %d, size = %d\n",__FUNCTION__,depth,size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment