Re: [PATCH 1/2] drm/edid: Use unsigned int in drm_add_modes_noedid()
From: Miguel Ojeda
Date: Wed Mar 26 2025 - 07:06:57 EST
On Wed, Mar 26, 2025 at 11:39 AM Jani Nikula
<jani.nikula@xxxxxxxxxxxxxxx> wrote:
>
> That is largely the point, though. You know something fishy is going on
> when you have a negative resolution. Nobody blinks an eye when you ask
> for 4294963K telly, but it's still just as bonkers as that negative 4K.
>
> I think the change at hand is fine, but please let's not pretend using
> unsigned somehow protects us from negative numbers.
Is there a reasonable maximum that could/should be checked for? (I
don't know the context)
In other words, if one wants to detect invalid values in a primitive
type, one needs to define the valid range anyway. Using the negatives
of a signed type is convenient in C, but perhaps there is a tighter
threshold?
If so, then an extra advantage is that on the Rust side one could also
have a proper strong type for this etc.
Cheers,
Miguel