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

Stephen Smalley <[email protected]> Fri, 24 Jul 2026 15:56:26 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ55VNg3fc58+mBk4zSFcu98b0nx4YY5dO23a1_vnMjAJA@mail.gmail.com>
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]>

> ---
>  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
>