[CRIU] [PATCH v5 04/15] autofs: parse fsinfo stage introduced

Pavel Emelyanov xemul at virtuozzo.com
Wed Jan 27 06:28:30 PST 2016


> +int autofs_parse(struct mount_info *pm)
> +{
> +	long pipe_ino = AUTOFS_OPT_UNKNOWN;
> +	char **opts;
> +	int nr_opts, i;
> +
> +	split(pm->options, ',', &opts, &nr_opts);
> +	if (!opts)
> +		return -1;
> +	for (i = 0; i < nr_opts; i++) {
> +		if (!strncmp(opts[i], "pipe_ino=", strlen("pipe_ino=")))
> +			pipe_ino = atoi(opts[i] + strlen("pipe_ino="));

Is strlen() works OK with constant strings? By OK I mean O(1) runtime.

> +	}
> +	free(opts);

The opts[i] is leaked for all i-s.

> +
> +	if (pipe_ino == AUTOFS_OPT_UNKNOWN) {
> +		pr_err("Failed to find pipe_ino option (old kernel?)\n");
> +		return -1;
> +	}
> +
> +	return autofs_gather_pipe(pipe_ino);
> +}
> diff --git a/include/autofs.h b/include/autofs.h



More information about the CRIU mailing list