On Mon, Sep 16, 2013 at 4:41 AM, Tetsuo Handa
<penguin-ker...@i-love.sakura.ne.jp> wrote:
> Kees Cook wrote:
>> -     seq_printf(m, "%s%d%n", con->name, con->index, &len);
>> -     len = 21 - len;
>> +     len = m->count;
>> +     seq_printf(m, "%s%d", con->name, con->index);
>> +     len = 21 - (m->count - len);
>
> Why not to create a new function which returns bytes written?
> The new function does not need to return negative value for indicating errors.

I think it's not worth it for two reasons:

- there are very few callers that need this logic
- it would require a new function for each type of function used
(right now both seq_printf and seq_puts are used).

Perhaps instead of seq->count, there should be an access function?
seq_get_count(seq) or something?

-Kees

-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
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