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: Tue, 09 Jan 2024 14:09:01 +0200
From: Kalle Valo <kvalo@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Jiri Slaby <jirislaby@...il.com>,  David Laight
 <David.Laight@...lab.com>,  "linux-kernel@...r.kernel.org"
 <linux-kernel@...r.kernel.org>,  Andy Shevchenko
 <andriy.shevchenko@...ux.intel.com>,  Andrew Morton
 <akpm@...ux-foundation.org>,  "Matthew Wilcox (Oracle)"
 <willy@...radead.org>,  Christoph Hellwig <hch@...radead.org>,  "Jason A.
 Donenfeld" <Jason@...c4.com>
Subject: Re: [PATCH next v4 0/5] minmax: Relax type checks in min() and max().

Linus Torvalds <torvalds@...ux-foundation.org> writes:

> On Mon, 8 Jan 2024 at 03:46, Jiri Slaby <jirislaby@...il.com> wrote:
>>
>>    CPP [M] drivers/media/pci/solo6x10/solo6x10-p2m.i
>> real    0m45,002s
>>
>> $ git revert 867046cc7027703f60a46339ffde91a1970f2901
>>    CPP [M] drivers/media/pci/solo6x10/solo6x10-p2m.i
>> real    0m11,132s
>>
>> $ git revert 4ead534fba42fc4fd41163297528d2aa731cd121
>>    CPP [M] drivers/media/pci/solo6x10/solo6x10-p2m.i
>> real    0m3,711s
>
> Ouch. Yeah, that's unfortunate. There's a lot of nested nasty macro
> expansion there, but that timing is excessive.
>
> Sparse actually complains about that file:
>
>   drivers/media/pci/solo6x10/solo6x10-p2m.c:309:13: error: too long
> token expansion
>   drivers/media/pci/solo6x10/solo6x10-p2m.c:310:17: error: too long
> token expansion
>
> and while that is a sparse limitation, it's still interesting. Having
> that file expand to 122M is not ok.
>
> In this case, I suspect the right thing to do is to simply not use
> min()/max() in that header at all, but do something like
>
>   --- a/drivers/media/pci/solo6x10/solo6x10-offsets.h
>   +++ b/drivers/media/pci/solo6x10/solo6x10-offsets.h
>   @@ -56,2 +56,5 @@
>
>   +#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
>   +#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
>   +
>    #define SOLO_MP4E_EXT_ADDR(__solo) \
>   @@ -59,4 +62,4 @@
>    #define SOLO_MP4E_EXT_SIZE(__solo) \
>   -     max((..),                               \
>   -         min(((..) - \
>   +     MAX((..),                               \
>   +         MIN(((..) - \
>                  ..), 0x00ff0000))
>   @@ -67,4 +70,4 @@
>    #define SOLO_JPEG_EXT_SIZE(__solo) \
>   -     max(..,                         \
>   -         min(..)
>   +     MAX(..,                         \
>   +         MIN(..)
>
> and avoid this issue.
>
> That said, I'm sure this thing exists to a smaller degree elsewhere. I
> wonder if we could simplify our min/max type tests..

FWIW we had similar sparse warnings in ath11k for which I added a
workaround:

https://git.kernel.org/netdev/net-next/c/fd6ed1772b2c

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ