Re: [PATCH] libselinux: Fix integer comparison issues when compiling for 32-bit

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

 



On Sun, Jul 7, 2024 at 3:00 AM Christian Göttsche
<cgzones@xxxxxxxxxxxxxx> wrote:
>
> On Mon, 1 Jul 2024 at 20:27, James Carter <jwcart2@xxxxxxxxx> wrote:
> >
> > Trying to compile libselinux for 32-bit produces the following error:
> >
> > selinux_restorecon.c:1194:31: error: comparison of integer expressions of different signedness: ‘__fsword_t’ {aka ‘int’} and ‘unsigned int’ [-Werror=sign-compare]
> >  1194 |         if (state.sfsb.f_type == RAMFS_MAGIC || state.sfsb.f_type == TMPFS_MAGIC ||
> >       |                               ^~
> >
> > Since RAMFS_MAGIC = 0x858458f6 == 2240043254, which > 2^31, but < 2^32,
> > cast both as uint32_t for the comparison.
>
> LGTM.
> Reviewed-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Do you have a reproducer for this? Building with -m32 didn't seem to
trigger the error for me on 64-bit Fedora.





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux