Re: [PATCH] libsepol: Use size_t for counting bytes in module.c

Stephen Smalley <[email protected]> Fri, 24 Jul 2026 16:19:58 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ7+uSNGYMORxwROD7rJUMW1_PZNpk=yBgVr2jVf7GGQ2g@mail.gmail.com>
On Fri, Jul 24, 2026 at 3:56 PM Stephen Smalley
<[email protected]> wrote:
>
> On Fri, Jul 24, 2026 at 3:28 PM James Carter <[email protected]> wrote:
> >
> > Use size_t for variables used to count bytes in the functions
> > read_helper() and write_helper().
> >
> > Signed-off-by: James Carter <[email protected]>
>
> Acked-by: Stephen Smalley <[email protected]>

Merged up through this one.

>
> > ---
> >  libsepol/src/module.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libsepol/src/module.c b/libsepol/src/module.c
> > index 5fcf5870..fdf05f12 100644
> > --- a/libsepol/src/module.c
> > +++ b/libsepol/src/module.c
> > @@ -345,7 +345,7 @@ int sepol_link_packages(sepol_handle_t *handle, sepol_module_package_t *base,
> >  #define _read_helper_bufsize BUFSIZ
> >  static int read_helper(char *buf, struct policy_file *file, uint32_t bytes)
> >  {
> > -       uint32_t offset, nel, read_len;
> > +       size_t offset, nel, read_len;
> >         int rc;
> >
> >         offset = 0;
> > @@ -842,7 +842,7 @@ cleanup:
> >
> >  static int write_helper(char *data, size_t len, struct policy_file *file)
> >  {
> > -       int idx = 0;
> > +       size_t idx = 0;
> >         size_t len2;
> >
> >         while (len) {
> > --
> > 2.55.0
> >