Commit faf07489 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

check_path_remap(): fix error checks

Naturally, checking strstr()+1 for NULL is useless.

Reported by Coverity, CID 51594.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e5654e58
......@@ -809,13 +809,13 @@ static int check_path_remap(struct fd_link *link, const struct fd_parms *parms,
char *start, *end;
/* skip "./proc/" */
start = strstr(rpath, "/") + 1;
start = strstr(rpath, "/");
if (!start)
return -1;
start = strstr(start, "/") + 1;
start = strstr(start + 1, "/");
if (!start)
return -1;
pid = strtol(start, &end, 10);
pid = strtol(start + 1, &end, 10);
/* if we didn't find another /, this path something
* like ./proc/kmsg, which we shouldn't mess with. */
......
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