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, 30 Oct 2023 10:59:24 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Alexey Dobriyan <adobriyan@...il.com>
Cc:     Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vsprintf: uninline simple_strntoull(), reorder arguments

On Fri, Oct 27, 2023 at 05:13:58PM +0300, Alexey Dobriyan wrote:
> * uninline simple_strntoull(),
>   gcc overinlines and this function is not performance critical
> 
> * reorder arguments, so that appending INT_MAX as 4th argument
>   generates very efficient tail call
> 
> Space savings:
> 
> 	add/remove: 1/0 grow/shrink: 0/3 up/down: 27/-179 (-152)
> 	Function                            old     new   delta
> 	simple_strntoll                       -      27     +27
> 	simple_strtoull                      15      10      -5
> 	simple_strtoll                       41       7     -34
> 	vsscanf                            1930    1790    -140


Makes sense to me
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

...

>  		if (is_sign)
> -			val.s = simple_strntoll(str,
> -						field_width >= 0 ? field_width : INT_MAX,
> -						&next, base);
> +			val.s = simple_strntoll(str, &next, base,
> +						field_width >= 0 ? field_width : INT_MAX);
>  		else
> -			val.u = simple_strntoull(str,
> -						 field_width >= 0 ? field_width : INT_MAX,
> -						 &next, base);
> +			val.u = simple_strntoull(str, &next, base,
> +						 field_width >= 0 ? field_width : INT_MAX);

Looking at these, why do we even care about signedness? field_witdh IIRC is 16-bit or less
and if size_t is to big it's still fine. No?

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ