kernel/cgroup.c: remove dead code
authorAdrian Bunk <bunk@kernel.org>
Thu, 7 Feb 2008 08:13:43 +0000 (00:13 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:17 +0000 (08:42 -0800)
This patch removes dead code spotted by the Coverity checker
(look at the "(nbytes >= PATH_MAX)" check).

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Paul Jackson <pj@sgi.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/cgroup.c

index 1a3c23936d43d99ec3d429123c95182a94de0c02..ae367471b07bd89595ae1f82dda0ea5de73fc3ac 100644 (file)
@@ -1355,16 +1355,14 @@ static ssize_t cgroup_common_file_write(struct cgroup *cgrp,
                if (nbytes && (buffer[nbytes-1] == '\n')) {
                        buffer[nbytes-1] = 0;
                }
-               if (nbytes < sizeof(root->release_agent_path)) {
-                       /* We never write anything other than '\0'
-                        * into the last char of release_agent_path,
-                        * so it always remains a NUL-terminated
-                        * string */
-                       strncpy(root->release_agent_path, buffer, nbytes);
-                       root->release_agent_path[nbytes] = 0;
-               } else {
-                       retval = -ENOSPC;
-               }
+
+               /* We never write anything other than '\0'
+                * into the last char of release_agent_path,
+                * so it always remains a NUL-terminated
+                * string */
+               strncpy(root->release_agent_path, buffer, nbytes);
+               root->release_agent_path[nbytes] = 0;
+
                break;
        }
        default: