Re: [PATCH] Verify memory sizes on 32 bit systems.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 03, 2018 at 02:07:34PM -0700, Lucas De Marchi wrote:
> > +       if ((uintmax_t)st.st_size > (uintmax_t)SIZE_MAX)
> 
> why casting?

Without casting, a warning could be triggered on 64 bit systems,
because on these systems a signed 64 bit int (off_t) is compared
with an unsigned 64 bit int (size_t) which could never be larger.

Casting it to uintmax_t, which is at least 64 bits in size,
silences this error.

No technical reason beyond that.


Tobias
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux