lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Sep 2021 13:51:59 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Yury Norov <yury.norov@...il.com>, Petr Mladek <pmladek@...e.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Chris Down <chris@...isdown.name>,
        Gilles Muller <Gilles.Muller@...ia.fr>,
        Ingo Molnar <mingo@...nel.org>,
        Jacob Keller <jacob.e.keller@...el.com>,
        Joe Perches <joe@...ches.com>,
        Julia Lawall <Julia.Lawall@...ia.fr>,
        Michal Marek <michal.lkml@...kovi.net>,
        Nicolas Palix <nicolas.palix@...g.fr>,
        Peter Zijlstra <peterz@...radead.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Stephen Boyd <swboyd@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, cocci@...teme.lip6.fr
Subject: Re: [PATCH v2 1/2] lib: add sputchar() helper

On 05/09/2021 01.10, Yury Norov wrote:
> There are 47 occurrences of the code snippet like this:
> 	if (buf < end)
> 	        *buf = ' ';
> 	++buf;
> 
> This patch adds a helper function sputchar() to replace opencoding.
> It adds a lot to readability, and also saves 43 bytes of text on x86.
> 
> v2: cleanup cases discovered with coccinelle script.
> 
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
>  include/linux/kernel.h |   8 ++

Sorry, but 47 cases, mostly in one .c file, is not enough justification
for adding yet another piece of random code to
the-dumping-ground-which-is-kernel.h, especially since this helper is
very specific to the needs of the vsnprintf() implementation, so
extremely unlikely to find other users.

I'm also not a fan of the sputchar name - it's unreadable at first
glance, and when you figure out it's "a _s_tring version of putchar",
that doesn't help, because its semantics are nothing like the stdio putchar.

Rasmus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ