[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJErvcfdq0=QDd2pwCeK7kKnJ-GY2ybv9ssdkF6NjNvDw@mail.gmail.com>
Date: Mon, 16 Sep 2013 07:59:42 -0700
From: Kees Cook <keescook@...omium.org>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc: LKML <linux-kernel@...r.kernel.org>, Joe Perches <joe@...ches.com>,
George Spelvin <linux@...izon.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Al Viro <viro@...iv.linux.org.uk>,
Jan Beulich <JBeulich@...e.com>,
Motohiro KOSAKI <kosaki.motohiro@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/2] remove all uses of printf's %n
On Mon, Sep 16, 2013 at 4:41 AM, Tetsuo Handa
<penguin-kernel@...ove.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists