On Sun, Nov 29, 2009 at 07:08:08PM +0200, Alex Vainman wrote:
> +     p_hpage_val = strstr(buf, label);
> +     if (!p_hpage_val) {
> +             errno = EINVAL;
> +             return -1;
> +     }
> +     p_hpage_val += strlen(label);
> +
> +     errno = 0;
> +     ret_val = strtol(p_hpage_val, &end_pointer, 0);

If strtol() fails, you may return with an invalid, non zero value for
huge page size. Maybe use some temporary variable to hold the
intermediate result.
> +
> +     if (errno != 0)
> +             return -1;
> +
> +     return ret_val * 1024;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to