On Tue, Dec 09, 2025 at 07:47:09AM +0000, Krzysztof Karas wrote:
> Hi Ville,
> 
> On 2025-12-08 at 19:15:42 +0200, Ville Syrjälä wrote:
> > On Thu, Dec 04, 2025 at 02:38:27PM +0000, Krzysztof Karas wrote:
> > > vpos (int) field multiplied by crtc_htotal (u16) may cause
> > > implicit promotion of the latter and overflow the result causing
> > > undefined behavior.
> > 
> > How is that undefined?
> Good question. It is well defined in C standard to wrap silently
> to fit in the new type, so operations may complete. I think this
> might have been caused by working with static analyzer at the
> time, which imprinted word "undefined" in my brain, so it made
> sense to use it here as well.
> 
> I believe "unexpected" may better describe the problem.
> I'll change that in the v6 of this series.

If you really want it then at least make it a (int) to match the 
other types in the expression. But personally I'd just drop the whole
thing since this is just normal C, and this does nothing to avoid any
overflows (which there won't be anyway unless some other code is super
buggy and returns nonsense hpos/vpos values).

-- 
Ville Syrjälä
Intel

Reply via email to