[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z1CgIzluYZzNVpuK@slm.duckdns.org>
Date: Wed, 4 Dec 2024 08:32:03 -1000
From: 'Tejun Heo' <tj@...nel.org>
To: David Laight <David.Laight@...lab.com>
Cc: Dan Carpenter <dan.carpenter@...aro.org>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
clang-built-linux <llvm@...ts.linux.dev>,
linux-block <linux-block@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
"lkft-triage@...ts.linaro.org" <lkft-triage@...ts.linaro.org>,
Linux Regressions <regressions@...ts.linux.dev>,
Anders Roxell <anders.roxell@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
Nathan Chancellor <nathan@...nel.org>, Jens Axboe <axboe@...nel.dk>
Subject: Re: s390: block/blk-iocost.c:1101:11: error: call to
'__compiletime_assert_557' declared with 'error' attribute: clamp() low
limit 1 greater than high limit active
Hello,
On Wed, Dec 04, 2024 at 06:26:16PM +0000, David Laight wrote:
> > This is a good catch. It's impressive that this can be caught at compile
> > time. The upper limit can become zero but the lower limit should win as
> > that's there to protect against divide by zero, so I think the right thinig
> > to do is replacing clamp() with max(min()). Is someone interested in writing
> > up the patch and sending it Jens' way?
>
> Perhaps if written as:
> inuse = min(inuse, active) ?: 1;
> it might stop someone changing it back.
And maybe some comments too. When I was writing that clamp(), the case of
min and max crossing each other didn't even cross my mind and I was dumbly
thinking just "oh, this protects the value on both fronts", so yeah, there's
some chance of someone (including myself) converting it back to clamp().
Thanks.
--
tejun
Powered by blists - more mailing lists