[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250225224954.4766e018@pumpkin>
Date: Tue, 25 Feb 2025 22:49:54 +0000
From: David Laight <david.laight.linux@...il.com>
To: Martin Uecker <uecker@...raz.at>
Cc: Steven Rostedt <rostedt@...dmis.org>, Linus Torvalds
<torvalds@...ux-foundation.org>, linux-kernel@...r.kernel.org,
ksummit@...ts.linux.dev
Subject: Re: Rust kernel policy
On Sat, 22 Feb 2025 00:37:01 +0100
Martin Uecker <uecker@...raz.at> wrote:
> Am Freitag, dem 21.02.2025 um 17:24 -0500 schrieb Steven Rostedt:
> > On Fri, 21 Feb 2025 11:30:41 -0800
> > Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> >
> > > And yes, it's wrong in general. The problems with "x < 0" warning for
> > > an unsigned 'x' are deep and fundamental, and macros that take various
> > > types is only one (perhaps more obvious) example of how brokent that
> > > garbage is.
> >
> > The bug I recently fixed, and I still constantly make, where this does
> > help, is the difference between size_t vs ssize_t. I keep forgetting that
> > size_t is unsigned, and I'll check a return of a function that returns
> > negative on error with it.
> >
> > If I could just get a warning for this stupid mistake:
> >
> > size_t ret;
> >
> > ret = func();
> > if (ret < 0)
> > error();
> >
> >
> > I'd be very happy.
> >
>
> GCC has this warning, it is called -Wtype-limits
That bleats about all sorts of stuff that is reasonable code.
>
> https://godbolt.org/z/M787vjhfo
>
> It is activated by -Wextra.
>
> (anyway, not at all related to my proposal)
>
> Martin
>
>
>
>
>
>
Powered by blists - more mailing lists