* Alexei Starovoitov <[email protected]> wrote:

> +void read_trace_pipe(void)
> +{
> +     int trace_fd;
> +
> +     trace_fd = open(DEBUGFS "trace_pipe", O_RDONLY, 0);
> +     if (trace_fd < 0)
> +             return;
> +
> +     while (1) {
> +             static char buf[4096];
> +             ssize_t sz;
> +
> +             sz = read(trace_fd, buf, sizeof(buf));

read() will return -1 on failure ...

> +             if (sz) {

... this test passes ...

> +                     buf[sz] = 0;

... and here we smash the stack?

> +                     puts(buf);
> +             }
> +     }


Thanks,

        Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to