Re: [PATCH 1/3] libsepol: use correct error type to please UBSAN

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

 



On Mon, Feb 14, 2022 at 2:59 PM James Carter <jwcart2@xxxxxxxxx> wrote:
>
> On Thu, Feb 10, 2022 at 4:09 PM Christian Göttsche
> <cgzones@xxxxxxxxxxxxxx> wrote:
> >
> > The callback function apply in hashtap_map has a return type of int and
> > can return -1 on error.  Use int as type to save the return value to
> > avoid implicit conversions:
> >
> >     hashtab.c:236:10: runtime error: implicit conversion from type 'int' of value -1 (32-bit, signed) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned)
> >
> > Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
>
> For all three patches:
> Acked-by: James Carter <jwcart2@xxxxxxxxx>
>

These three patches have been merged.
Thanks,
Jim

> > ---
> >  libsepol/src/hashtab.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libsepol/src/hashtab.c b/libsepol/src/hashtab.c
> > index 2eb35212..3ecaf165 100644
> > --- a/libsepol/src/hashtab.c
> > +++ b/libsepol/src/hashtab.c
> > @@ -224,8 +224,9 @@ int hashtab_map(hashtab_t h,
> >                 int (*apply) (hashtab_key_t k,
> >                               hashtab_datum_t d, void *args), void *args)
> >  {
> > -       unsigned int i, ret;
> > +       unsigned int i;
> >         hashtab_ptr_t cur;
> > +       int ret;
> >
> >         if (!h)
> >                 return SEPOL_OK;
> > --
> > 2.34.1
> >




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

  Powered by Linux