Hi Mark, LGTM.
Aaron On Sun, Nov 8, 2026 at 6:44 PM Mark Wielaard <[email protected]> wrote: > > chunk_compare is a tsearch compar callback that returns an > int. Returning the difference between two 64bit values will get > implicitly casting down to an int. This means if the result might cast > down to zero if it is an exactly 32bits difference. So explicitly > return -1 or 1. > > * libelf/elf_getdata_rawchunk.c (chunk_compare): For offset > and d_size compare and return -1 or 1. > > Signed-off-by: Mark Wielaard <[email protected]> > --- > libelf/elf_getdata_rawchunk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libelf/elf_getdata_rawchunk.c b/libelf/elf_getdata_rawchunk.c > index d2610b6efa97..856bdaaa739c 100644 > --- a/libelf/elf_getdata_rawchunk.c > +++ b/libelf/elf_getdata_rawchunk.c > @@ -45,10 +45,10 @@ chunk_compare (const void *a, const void *b) > Elf_Data_Chunk *db = (Elf_Data_Chunk *)b; > > if (da->offset != db->offset) > - return da->offset - db->offset; > + return da->offset < db->offset ? -1 : 1; > > if (da->data.d.d_size != db->data.d.d_size) > - return da->data.d.d_size - db->data.d.d_size; > + return da->data.d.d_size < db->data.d.d_size ? -1 : 1; > > return da->data.d.d_type - db->data.d.d_type; > } > -- > 2.56.0 >
