Re: [PATCH] thermal/drivers/mediatek/lvts_thermal: fix memcpy's number of bytes in lvts_calibration_init()

Dan Carpenter
2023-03-09T12:37:54Z

On Wed, Mar 08, 2023 at 10:10:34AM +0100, AngeloGioacchino Del Regno wrote:
> Il 07/03/23 14:42, bchihi@baylibre.com ha scritto:
> > From: Balsam CHIHI <bchihi@baylibre.com>
> >
> > Replace memcpy 2 bytes by sizeof(int) bytes of LVTS calibration data.
>
> sizeof(int) is architecture dependant...
>

On Linux sizeof(int) is always 4.

I'm just so confused what you are talking about. Are you thinking about
sizeof(long)? Are you thinking about CPUs from the 1970s? Linux wasn't
invented until the 90s so the old CPUs were already in museums at that
point.

> please use a fixed size type instead.

This is an unusual style opinion that I have not heard before.
Hopefully, you just got ints and longs confused so we can move on
without discussing it too much. We're copying an int so sizeof(int) is
obviously correct. It's hard to know how to respond.

> Also, shouldn't this be u16?!

What? Why would you think that?

regards,
dan carpenter